Question: Basic python: dont use list Thank you. comments please # Details The program has 4 functions: main - loop to call the getNum () function

Basic python: dont use list

Thank you.

comments please #

Details

The program has 4 functions:

main - loop to call the getNum () function and end the loop when getNum () returns 0.

- in the loop, call the process () function to process 2 or 3 random numbers.

getNum

- loop to ask the user to enter 2, 3, or 0

- keep looping until you get one of these 3 values, and then return the value

process

- loop until the user enters "end". In the loop:

- generate 2 or 3 random numbers, depending on the user input. The numbers are in the range of 1 - 3.

- call the same () function and, if needed, call the diff () function

- keep track of the result of the same () or diff () function

- ask the user to hit the Enter key to continue or type "end" to end the number generating loop

- when the loop ends:

- print the result from the same () or diff () function:

number of times the numbers are duplicates / number of times the user generates numbers

See sample program output.

same

- return True or False, depending on whether the 2 or 3 random numbers are identical

diff

- return the smallest value of the 2 or 3 random numbers or return None if 2 of the numbers are the same.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!