''' Purpose: Experience the thrill of random generation and list examination Task: Prompt and get three integers s, n, and d from its user (in that order). Use integer s as a seed to the Python random number generator. Then print n octal digits (base 8 digits) line by line by line. Then print the number of generated occurrences of d. There should be no other output Checker: ''' # needed module import random # Get the input reply = input( 'Enter three numbers: ' ) print() # Convert the input into the integers s, n, d s, n, d = reply.split() s = int( s ) # seed n = int( n ) # number of values d = int( d ) # value of interest # Set the seed for generating random values random.seed( s ) # Generate n random octal numbers and store them in a list # Start by initializing the list holder octals = [] # One-by-one add n octal numbers to the list holder for i in range( 0, n ) : octal = random.randrange( 0, 8 ) # or random.randrange( 8 ) , these are equivalent do whichever you like more octals.append( octal ) # Print the list print( "octal digit list:", octals ) print() # Determine number of generated octal values equal to d and print d_count = octals.count( d ) print( "number of times value", d, "in list:", d_count )