Question: Write a program that prompts the user to enter a line of data. You can assume that each item of data is separated by
Write a program that prompts the user to enter a line of data. You can assume that each item of data is separated by a space character. Your program should convert this line of data into a corresponding list of data. If a data item in this list is a valid string representation of an integer, it needs to be converted into an integer value. You can assume that you will only be dealing with non-negative integers. Finally, your program should print out the data list. Note: You must use a for...in loop and the range () function. The output of the program must be in the format shown in the examples below, including the format of the prompt, and all spaces and punctuation. For example: Input Result Two 3 0 5 Hello Enter your data: Two 3 0 5 Hello 1 2 3 4 5 List of data: ['Two', 3, 0, 5, 'Hello'] Enter your data: 1 2 3 4 5 List of data: [1, 2, 3, 4, 5]
Step by Step Solution
3.37 Rating (163 Votes )
There are 3 Steps involved in it
Sure heres a program that meets your requirements prompt Enter your data Get a line of data from the ... View full answer
Get step-by-step solutions from verified subject matter experts
