help me ! I do not understand what the error is. check writes that there is a syntax error in x. python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help me ! I do not understand what the error is. check writes that there is a syntax error in x. python

age = int(input()) x = input() if age >= 18: print ("Welcome" x) else: print ('Sorry' x)

4th Jun 2021, 8:33 PM
Dima • Play
Dima • Play - avatar
2 Answers
+ 2
You can't just strictly put the variable after the strings. But you can put a comma between them: print("Welcome", x) print('Sorry', x)
4th Jun 2021, 8:37 PM
Seb TheS
Seb TheS - avatar
+ 2
>>> "Welcome "+str(5) # welcome 5 >>> "welcome "+ "5" # welcome 5 >>> print("welcome",5) # welcome 5 >>>"welcome {}".format(5) # welcome 5 >>> f"welcome {5}" # welcome 5 https://www.sololearn.com/learning/2427/
4th Jun 2021, 8:50 PM
Ratnapal Shende
Ratnapal Shende - avatar