Question: im looking for help with this step Add a function named get _ float ( ) to the program. This function should accept one argument,
im looking for help with this step Add a function named getfloat to the program. This function should accept one argument, which is a prompt like Enter monthly investment: Then, this function should use the input function to get an entry from the user using the prompt thats passed to it and the entry should be converted to a float value. Next, this function should check this entry to make sure its greater than If it is the entry is valid and the number should be returned to the calling statement. If it isnt an appropriate error message should be displayed, and the user should enter another value. To make this work, the function should use a while statement that gets an entry until it is valid. into this code def getfloatprompt lowvalue, highvalue:
while true: floatinputprompt
lowvalue
def calculatefuturevaluemonthlyinvestment, yearlyinterest, years:
# convert yearly values to monthly values
monthlyinterestrate yearlyinterest
months years
# calculate future value
futurevalue
for i in rangemonths:
futurevalue monthlyinvestment
monthlyinterest futurevalue monthlyinterestrate
futurevalue monthlyinterest
return futurevalue
def main:
choice y
while choice.lowery:
# get input from the user
monthlyinvestment floatinputEnter monthly investment:t
yearlyinterestrate floatinputEnter yearly interest rate:t
years intinputEnter number of years:tt
# get and display future value
futurevalue calculatefuturevalue
monthlyinvestment, yearlyinterestrate, years
printfFuture value:tttroundfuturevalue,
print
# see if the user wants to continue
choice inputContinueyn:
print
printBye
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
