Question: PYTHON Programming Write a program that populates a list called new_list with the numbers from the list rand_num, but if the number is divisible by

PYTHON Programming

Write a program that populates a list called new_list with the numbers from the list rand_num, but if the number is divisible by 4 and 7, you replace it by the word "HumptyDumpty"; if the number is divisible by 4, you replace it by "Humpty"; and if the number is divisible by 7, you replace it by "Dumpty". All the other numbers should remain as numbers.

PYTHON Programming Write a program that populates a list called new_list with

Exercise 1 Write a program that populates a list called new_list with the numbers from the list rand_num , but if the number is divisible by 4 and 7, you replace it by the word "Humpty Dumpty"; if the number is divisible by 4, you replace it by "Humpty"; and if the number is divisible by 7, you replace it by "Dumpty". All the other numbers should remain as numbers. In [ ]: # DO NOT MODIFY THIS CELL numpy.random.seed (86) rand_num = numpy.random.randint(1000, 10000, size=100) In [ ]: new_list [] # YOUR CODE HERE raise NotImplementedError( ) In [ ]: |

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!