0
how to define specific user input
name = input("Hello, what is your name?") if name = "Nikolas": print("Hello " + name) What I want to do is that if I enter a specific name like Nikolas, for it to say "Hello Nikolas". And if something different is entered, then there's no output. This code gives me a SyntaxError, why? What am I doing wrong?
2 Réponses
+ 3
= is the operator for variable assignment.
== is the operator to test for equality.
name = input("Hello, what is your name?")
if name == "Nikolas":
print("Hello " + name)
0
Oh, thank you