Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

1. Design an effective socialization program for employees.

Answered: 1 week ago