Ask coding questions

← Back to all posts
how do you ask the name
petrhejtmanek (4)

what is your name and i want a question and it will reply hello name

ash15khng (712)

To ask a question and get the response from the user you can do this:

var = input("Question")

var is the variable you want to save the text from the user to.
To print a variable with a string you can do this:

print("Hello", var)

Combining these two things gives this:

name = input("What is your name? ")
print("Hello, ", name)
LyLaAaAa (0)

I need to ask them for their name AND last name but I'm not sure how to do it.

PhilLongden (0)

name = input("What is your name?")