Ejemplo 1: programa de Python para interés simple
principle=float(input("Enter the principle amount:"))
time=int(input("Enter the time(years):"))
rate=float(input("Enter the rate:"))
simple_interest=(principle*time*rate)/100print("The simple interest is:",simple_interest)
Ejemplo 2: calculadora de interés simple usando Python
defInterest():
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 formulaprint('S.I. = '+str(Simple))defPrincipal():
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 formulaprint=('Principal = '+str(principal))defRate():
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 formulaprint=('Rate = '+str(rate))defTime():
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 formulaprint=('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. ')
Valoraciones y comentarios
Si te ha resultado provechoso nuestro post, sería de mucha ayuda si lo compartieras con más seniors y nos ayudes a extender nuestro contenido.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)