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)
2 Antworten
+ 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)
+ 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/