Everything works except my name, it sayd that Nikola is not identified. How do i make it recognise my name? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Everything works except my name, it sayd that Nikola is not identified. How do i make it recognise my name?

#FakeBook name = str(input("Enter your name: ")) print(name) age = int(input("Enter Age: ")) print(age) if (age >= 24): print("Bro you old") if(age<1000): print("Its less than 1000") if (name == Nikola): print("But ur Nikola so its ok")

17th Nov 2019, 8:19 PM
Nikola lazic
Nikola lazic - avatar
4 Answers
+ 5
Nikola is considered as a variable, it does not exist. Use double quotes for strings: if(name == "Nikola"):
17th Nov 2019, 8:21 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
No problem 👌
17th Nov 2019, 8:24 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
Just an extra: user input is a string by default, so you don't need to convert it with str().
18th Nov 2019, 6:00 AM
Njeri
Njeri - avatar
+ 1
Oh yeah.. thanks Ill try it out right away :D
17th Nov 2019, 8:24 PM
Nikola lazic
Nikola lazic - avatar