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?

12th Sep 2016, 9:38 AM
Nickolas Gilshtain (NickGaming)
Nickolas Gilshtain (NickGaming) - avatar
2 Respostas
+ 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)
12th Sep 2016, 10:12 AM
Zen
Zen - avatar
0
Oh, thank you
12th Sep 2016, 10:21 AM
Nickolas Gilshtain (NickGaming)
Nickolas Gilshtain (NickGaming) - avatar