Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 17th International Conference Dasfaa 2012 Busan South Korea April 2012 Proceedings Part 1 Lncs 7238

Authors: Sang-goo Lee ,Zhiyong Peng ,Xiaofang Zhou ,Yang-Sae Moon ,Rainer Unland ,Jaesoo Yoo

2012 Edition

364229037X, 978-3642290374

Students also viewed these Databases questions

Question

LOQ 14-4: What developmental stages did Freud propose?

Answered: 1 week ago