Question: Write a program named program5_2.py that prompts the user to enter an integer (maximum 20). If the user complies, main() should call a value-returning function
Write a program named program5_2.py that prompts the user to enter an integer (maximum 20). If the user complies, main() should call a value-returning function named randnums with this value as its sole argument. The randnums function should use the argument to generate an equivalent number of random integers (all from 1-9). These integers should be printed all on one line. The randnums function should also determine the total of the random numbers and return this total to main() for printing. See Sample Output. If the user does not comply with the input request, the program should print a corrective message and randnums should not be called. Sample Output (2 runs) How many random integers (max 20)? 12 5 9 7 7 9 8 8 2 5 5 8 7 Integers total is 80
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
