Question: Here is a little practice using random numbers.First import the random module:import randomNow get a random integer and assign it to the variable n:n =
Here is a little practice using random numbers.First import the random module:import randomNow get a random integer and assign it to the variable n:n random.randrangeNow for the hard part.Use a while loop that calls random.randrange and compares the result to n Use a counter to count each time through the loop. When the result equals n print the following:printfgot n in counter attempts!and break out of the loop. If you don't break out of the loop, your program will not terminate... ever.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
