Question: PYTHON QUESTION - Iterate through the list and determine how many values were ODD and how many were EVEN in python. Print out the count

PYTHON QUESTION - Iterate through the list and determine how many values were ODD and how many were EVEN in python. Print out the count for each type at the end of the program and what percentage it was of the total.

# bring in randomness cause we need it in our lives import random import percentage as percentage def generate_random_int_list(max_length, upper_bound): # generate random length between 2 and max_length list_length = int(random.uniform(2, max_length)) # given the length above, sample the Natural Numbers up to upper_bound that many times vars = random.sample(range(upper_bound), list_length) # return the generated list return vars # generate two random lists of integers max_length = 100; upper_bound=1000000 nums = generate_random_int_list(max_length, upper_bound) # see how long this list is print("The list contains "+str(len(nums))+" values total.") 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!