How do I write a program that uses raw_input
to prompt a user for their name and then welcomes him.
For example that asks: Enter your name
, and then the program continues welcoming the user with Hello NAME_OF_THE_USER
This is one of the easiest problem ever. This is my solution (since you tagged your post for Python 3):
name = input('Enter your name: ')
print("Welcome", name)
For Python 2, just change input
to raw_input
, and remove the parenthesis of the print
function.