Write a progrogram that prompts the user for a value greater than 10 as an input
ID: 3546802 • Letter: W
Question
Write a progrogram that prompts the user for a value greater than 10 as an input (you should loop until the user enters a valid value) and finds the square root of that number and the square root of the result, and continues to find the square root of the result until we reach a number that is smaller than 1.01. The program should output how many times the square root operation was performed.
Explanation / Answer
ef input_numbers(): while True: num1 = raw_input("Enter a positive integer no greater than 42 ") if num1 42: print "The number cannot exceed 42. Try again " num2 = raw_input("Enter another positive integer ") if num2 42: print "The number cannot exceed 42. Try again " num3 = raw_input("Enter another positive integer ") if num3 42: print "The number cannot exceed 42. Try again " num4 = raw_input("Enter another positive integer ") if num4 42: print "The number cannot exceed 42. Try again " num5 = raw_input("Enter another positive integer ") if num5 42: print "The number cannot exceed 42. Try again " elif sum(num1, num2, num3, num4, num5) > 179: print_numbers() add_numbers() def add_numbers(): print_numbers() def print_numbers(): input_numbers()Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.