Computer Applications
What will be output of the following code if the user enters Principal amount as 20000 and Time as 10 years.
#Considering Python 2.7
P = input("Enter Principal amount:")
T = input("Enter Time:")
if T > 10:
SI = P*T*10/100
else:
SI = P*T*15/100
print("Simple Interest = ", SI)
Python Control Flow
1 Like
Answer
Enter Principal amount:20000
Enter Time:10
Simple Interest = 30000
Working
This Python program calculates the Simple Interest (SI) based on the given Principal amount (P) and Time (T) values. For time value of more than 10 years, the program takes the rate of interest as 10% and for 10 years or less it takes the rate of interest as 15%.
Answered By
2 Likes
Related Questions
Predict the output of the following code fragments:
count = 0 while count < 10: print ("Hello") count += 1Predict the output of the following code fragments:
x = 10 y = 0 while x > y: print (x, y) x = x - 1 y = y + 1Write a Python script that asks the user to enter a length in centimetres. If the user enters a negative length, the program should tell the user that the entry is invalid. Otherwise, the program should convert the length to inches and print out the result. There are 2.54 centimetres in an inch.
Write a program that asks the user for two numbers and prints Close if the numbers are within .001 of each other and Not close otherwise.