''' Soren DeOrlow IDSN 599, Fall 2021 deorlow@usc.edu Lab Practical 4 ''' while True: # Establishes random functionality import random # Generate dictionary ranging from 2-52, # the key will count the factors and is set with a starting value of 0 counts = {} for key in range(2, 52): counts[key] = 0 # Request number: Ask user to input a number (x) that will drive the calculation numbers = input("Enter how many numbers to generate ") if numbers != " ": # this statement forces users to enter a number print("") print("FOR" ,numbers, "RANDOM NUMBERS HERE ARE THE FACTOR FREQUENCIES FOR") print("") # Input will generate (x) random numbers across a range from 0 to 10000 numbers = int(numbers) for value in range(numbers): value = random.randint(0, 10001) results = "" # print(value) counts[2] + - 1 # Count divisibility of random numbers by dictionary numbers for key in range(2, 52): if value % key == 0: counts[key] += 1 # this sets a count within the key of each dictionary number # print(counts) for key in range(2, 52): print(key, "*" * counts[key]) # this converts the count to an asterisk and prints full library taxonomy # Begin next calculation print("") else: print("Please enter a number.") ''' # CODE PROCESS SKETCHING #if numbers != int(): #print("Please enter a number!") #else: #print("Please don't leave the field blank!") import random # generate random numbers between 0-10000 span = range(53) for item in span: print(item) import random # Request number: Ask user to input a number (x) nInput = input("Please enter a number: ") print("For " + nInput + " random numbers, here the the factor frequencies...") # Random number generation: Create (x) random numbers within a range of 0,10000 nInput = int s = set() N = 20 M = 10000 randomCandidates = list(range(M)) for _ in range(nInput): randomCandidates = random.randrange(M) while randomCandidates in s: randomCandidates = random.randrange(M) s.add(randomCandidates) print(randomCandidates) results = "" dictionary = {2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0,19:0,20:0,21:0,22:0,23:0,24:0,25:0,26:0,27:0,28:0,29:0,30:0,31:0,32:0,33:0,34:0,35:0,36:0,37:0,38:0,39:0,40:0,41:0,42:0,43:0,44:0,45:0,46:0,47:0,48:0,49:0,50:0,51:0,52:0} # Create factor frequency list for numberd 2-51 # if results() % 2 == 0: # print("2") # if results % 3 == 0: # print("3") # if results % 4 == 0: # print("4") # if results % 5 == 0: # print("5") # Create factor frequency list for numberd 2-51 # Range (0:10000) # factors (2:52) # The numbers must be within 0 & 10k # random.randint(0, 10000) # random.randrange(start, stop[, step]) step equals divisible number # list1 = [nList] # print (random.choice(list1)) #span = range(53) #for item in span: #print(item) '''