Where is the error in my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Where is the error in my code?

My code below seems correct but it isn't valid when i run it age = int(input()) name = input() # your code goes here if age >= 18: print("Welcome ",name) else: print ("Sorry")

16th Apr 2021, 10:23 AM
Fohom Mike-eddie Guidy
Fohom Mike-eddie Guidy - avatar
5 Answers
+ 6
the issue in the code is, that the output has an additional whitespace between "Welcome" and name. as you are using comma to separate the print() statement, you don't need an extra space. this is only necessary when concatenating the output with the "+" operator
16th Apr 2021, 10:43 AM
Lothar
Lothar - avatar
+ 4
Fohom Mike-eddie Guidy , for the future please use a tag to mention the programming language you are talking about. thanks
16th Apr 2021, 10:39 AM
Lothar
Lothar - avatar
+ 3
I will do it Yaroslav. Thank you
16th Apr 2021, 10:51 AM
Fohom Mike-eddie Guidy
Fohom Mike-eddie Guidy - avatar
+ 2
Thank you Lothar, it works now. Have a nice day
16th Apr 2021, 10:49 AM
Fohom Mike-eddie Guidy
Fohom Mike-eddie Guidy - avatar
0
Hi! your code works perfectly! what you don't like?
16th Apr 2021, 10:34 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar