Question: Write a program that reads in a bunch of integers from the user on a single line called numbers, each separated by a space, and

Write a program that reads in a bunch of integers from the user on a single line called numbers, each separated by a space, and then will create a list of those numbers, and replace each element greater than 10 with a '*'. Print the new version of numbers.
Examine the starting code and answer the following questions:
What type is the variable numbers after line 2(after the input statement) is executed?
string
list
int
bool
Check It!
What type is the variable numbers after line 3(after the split method) is executed?
string
list
int
bool
Check It!
What type are the elements of numbers after the split?
float
int
string
list
The line of numbers came into Python as a single string with spaces. After the split, there is a list of strings that look like numbers. You will need to iterate through the list to convert those strings to integers.
Check It!
Expected Output
If the user typed in 30,1,20,4 then you will print ['*',1,'*',4]
If the user typed in 5,9,11,23 then you will print [5,9,'*','*']
Dont forget that since you will be doing math on the list of input numbers to compare them with 10, you will have to convert them from strings to integer.
Hint
Testing Your Code
Try your code with numbers 301204 and with numbers 591123

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 Programming Questions!