simple interest calculator using python code example
Example: simple interest calculator using python
def Interest():
principal = input('Enter the principal: ')
rate = input('Enter the rate: ')
time = input('Enter the time: ')
Simple = ( (int(principal) * int(rate) * int(time)) / int('100')) #interest formula
print('S.I. = ' + str(Simple))
def Principal():
rate = input('Enter the rate: ')
time = input('Enter the time: ')
interest = input('Enter the simple interest')
principal = ( (int('100') * int(interest)) / (int(rate) * int(time))) #principal formula
print = ('Principal = ' + str(principal))
def Rate():
time = input('Enter the time: ')
interest = input('Enter the simple interest')
principal = input('Enter the principal: ')
rate = ( (int('100') * int(interest)) / (int(principal) * int(time))) #rate formula
print = ('Rate = ' + str(rate))
def Time():
interest = input('Enter the simple interest')
principal = input('Enter the principal: ')
rate = input('Enter the rate: ')
time = ( (int('100') * int(interest)) / (int(principal) * int(rate))) #time formula
print = ('Time = ' + str(time))
question = input('What do you want to find: ')
if question == 'interest': #calls functions if input = the specified string
Interest()
elif question == 'principal':
Principal()
elif question == 'rate':
Rate()
elif question == 'time':
Time()
else:
print('That is not a valid value mate. ')