(Solved):Assign user_str with a string from user input, with the prompt: Enter a string. (Hint: Replace the ? in the following code) User_str= ?( Enter a string: ) View Answer…

 

Question

Assign user_str with a string from user input, with the prompt: ‘Enter a string.’ (Hint: Replace the ? in the following code)

user_str= ? ('Enter a string: ')

 

EXPERT ANSWER

Using Python3, one could prompt the user input in the following way:

user_str = input('Enter a string: ')

On running the above script, a prompt occurs asking for the user input,

Scroll to top