def readFloat(prompt)
that displays the prompt string, followed by a space, reads a floating-point number in, and returns it. Below is how you’re going to call the function:
salary = readFloat(“Please enter your salary:”)
percentageRaise = readFloat(“What percentage raise would you like?”)
print("The salary is", salary)
print("The raise percentage is", percentageRaise)
keep it simple, python
def readFloat(prompt): n = float(input(prompt+" ")) return n def main(): salary = readFloat("Please enter your salary:") percentageRaise = readFloat("What percentage raise would you like?") print("The salary is", salary) print("The raise percentage is", percentageRaise) main()
Get Answers For Free
Most questions answered within 1 hours.