If I apply a string - say a ="cars" and give a== cars I will get a syntax error after a boolean operation.Why is that.?? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

If I apply a string - say a ="cars" and give a== cars I will get a syntax error after a boolean operation.Why is that.??

24th Apr 2017, 12:50 PM
Naseef
Naseef - avatar
2 Antworten
+ 3
You have to understand the basic concept thoroughly to provide a good foundation for more complex tasks.Remember:Strings need " or ' before and after them.Also,strings embedded in functions do not produce quotation marks. Eg: print("Python is awesome") Result: Python is awesome
24th Apr 2017, 2:12 PM
Vishal Ramprasad
Vishal Ramprasad - avatar
0
You should enclose "cars" in double qutations as a is String and you need to compare it with String only.
24th Apr 2017, 12:54 PM
Vishal Prajapati