Q11. Write a python script to calculate and print Simple Interest?
Write a python script to calculate and print Simple Interest?
Sol:
p=float(input("Enter principle ")) r=float(input("Enter rate ")) t=float(input("Enter time ")) si=(p*r*t)/100 print("SI = ",si)Go Top
Write a python script to take input for two numbers and interchange them (swap them)? (Method :1)(using third variable)
Sol:
a=int(input("Enter 1st no ")) b=int(input("Enter 2nd no ")) print("1st value ",a," 2nd value ",b) t=a a=b b=t print("1st value ",a," 2nd value ",b)
Write a python script to take input for two numbers and interchange them (swap them)? (Method :2)(without using third variable)
Sol:
a=int(input("Enter 1st no ")) b=int(input("Enter 2nd no ")) print("1st value ",a," 2nd value ",b) a=a+b b=a-b a=a-b print("1st value ",a," 2nd value ",b)
Write a python script to take input for two numbers and interchange them (swap them)? (Method :3)(Only Python can do it)
Sol:
a=int(input("Enter 1st no ")) b=int(input("Enter 2nd no ")) print("1st value ",a," 2nd value ",b) a,b=b,a print("1st value ",a," 2nd value ",b)