Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

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 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

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions