Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 66)
66.
How can you read a string from the console, replace all spaces with underscores, and print the result?
print(replace_spaces(input("Enter a string: ")))
string_input = input("Enter a string: "); print(string_input.replace(" ", "_"))
replace_chars(get_user_string())
print(replace_whitespace(get_input()))
Answer: Option
Explanation:
To read a string from the console, replace all spaces with underscores, and print the result, use string_input = input("Enter a string: "); print(string_input.replace(" ", "_")).
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.