Why does this always say syntax error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why does this always say syntax error

The code im using is pyhton l = b i = input ("whats letter does my name start with?") if i == l print("yes correct!") else: print("no brayden starts with a b!")

24th Sep 2018, 9:21 PM
GD cheerios YT
GD cheerios YT - avatar
4 Answers
+ 2
Depends of what the l variable should have in value. If it's a string, just add "b". If not, create a variable called b or functions, objects etc.
24th Sep 2018, 9:36 PM
Chalza
Chalza - avatar
+ 2
First, in "l = b" the b is not defined, you need to define b before using it. And an error in the if statement, : is missing after l.
24th Sep 2018, 9:26 PM
Chalza
Chalza - avatar
+ 1
l = 'b' #put character in single quote, otherwise it is regarded as an unkwon variable if i == l: # colon was missing Additional remark: do not use l as variable name, since in some fonts it looks the same as I (big i)
24th Sep 2018, 9:28 PM
Matthias
Matthias - avatar
0
How do you define? Im noob
24th Sep 2018, 9:34 PM
GD cheerios YT
GD cheerios YT - avatar