Question: Exercise 1 Write a program that populates a list called new_list with the numbers from the list rand_num, but if the number consists of 2

 Exercise 1 Write a program that populates a list called new_list

Exercise 1 Write a program that populates a list called new_list with the numbers from the list rand_num, but if the number consists of 2 digits replace it by the word "Pina Colada"; if the number consists of 3 digits, you replace it by "Pineapple Juice"; if the number has more than 3 digits and divisible by 5 you replace it by "Coconut Milk". All the other numbers should remain as numbers. Hint: to use len( ) function to find the how many digits in a number you neet to first transform the number into a string with str ( i ) \# DO NOT MODIFY THIS CELL numpy.random.seed (86) rand_num = numpy.random.randint (10,10000, size=100) new_list = [ ] \# YOUR CODE HERE raise NotImplementedError()

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!