Why syntax error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why syntax error

Is it because of indenting or error in code im not very good at indenting years_ahead = input("type many years do you want to pass by") print("new ages of the gang") age = {"Bob": 30, "Dob": 24, "Mob": 31} def aging(x, y, z): xx = x + int(years_ahead) yy = y + int(years_ahead) zz = z + int(years_ahead) if xx >= 90: print(str(x) + ":dead") print(str(x) + "\'s corpse age:" + str(xx)) else: print(str(x) + (":") + str(xx)) if yy >= 120: print(str(y) + ":dead") print(str(y) + "\'s corpse age:" + str(yy) else: print(str(y) + (":") + str(yy)) if zz >= 110: print(str(z) + ":dead") print(str(z) + "\'s corpse age:" + str(zz)) else: print(str(z) + (":") + str(zz)) aging(age["Bob"], age["Dob"], age["Mob"]) 

27th Sep 2020, 5:59 PM
Somebody
Somebody - avatar
9 Answers
+ 5
Which error exactly?
27th Sep 2020, 6:04 PM
Oma Falk
Oma Falk - avatar
+ 5
Line 17 ) missing
27th Sep 2020, 6:30 PM
Oma Falk
Oma Falk - avatar
+ 4
Try to delete braces ":" instead of (":")
27th Sep 2020, 6:10 PM
Oma Falk
Oma Falk - avatar
+ 1
it says this File “./Playground/file0.py”, line 18 else: ^ SyntaxError: invalid syntax
27th Sep 2020, 6:19 PM
Somebody
Somebody - avatar
+ 1
yeah and “:” didnt work
27th Sep 2020, 6:26 PM
Somebody
Somebody - avatar
0
invalid syntax
27th Sep 2020, 6:08 PM
Somebody
Somebody - avatar
0
line 18
27th Sep 2020, 6:09 PM
Somebody
Somebody - avatar
0
what
27th Sep 2020, 6:57 PM
Somebody
Somebody - avatar
0
wait oh i get it thanks brother
29th Sep 2020, 7:24 PM
Somebody
Somebody - avatar