+ 1
Why this code doesn't work any_thing= 12 print("the best person is " + any_thing )
any_thing= 12 print("the best person is " + any_thing )
6 Answers
+ 5
ZIZO Abd alkawy ,
you can do it also without converting :
any_thing= 12
print("the best person is", any_thing)
+ 4
Because any_thing is an integer type.
You cannot concatenate string and integer like how you have tried.
While printing do + str(any_thing)
+ 3
any_thing= 12
print("the best person is " + str( any_thing))
+ 1
12 is an integer, "the best person is " is a string, You cannot concentrate these together without converting 12 to a string which can be done with str(any_thing)
You can also use f-strings. print(f"the best person is {any_thing}") (the f before the " is required)
0
Semicolon i think