Feb-21-2018, 11:02 PM
2. Part 2 - Statistics on Random Numbers - 5pts
Generate 500 random numbers on the interval 1 to 65536. Determine the fraction of these numbers which are greater than or equal to 512 and less than or equal to 2048. Display the result. Stop execution by means of an input statement which asks the user if they want to execute the next part of the assignment, prompt for a ’Y’ to continue or ’N’ to terminate execution.
import random
for x in range(500):
print random.randint(1,65536)
I need help with the second part
Generate 500 random numbers on the interval 1 to 65536. Determine the fraction of these numbers which are greater than or equal to 512 and less than or equal to 2048. Display the result. Stop execution by means of an input statement which asks the user if they want to execute the next part of the assignment, prompt for a ’Y’ to continue or ’N’ to terminate execution.
import random
for x in range(500):
print random.randint(1,65536)
I need help with the second part