Error from IDLE dunno what to do!!
How do you solve this guys TypeError: can only concatenate str (not "int") to str ??? I am quite new to Python programming so I need some help over here!
Voters
How do you solve this guys TypeError: can only concatenate str (not "int") to str ??? I am quite new to Python programming so I need some help over here!
So you have to add
str
before the variable.For example:
Hope this helps!
@Bookie0 Thanks!!
@Bookie0 But what if my variable has input ? a = input()
It still gives me error this is my mini-program:
a = input()
print("The next number for the number" + str(a) + "is" + str(a + 1))
print("The previous number for the number" + str(a) + "is" + str(a - 1))
@Bitkoshy hmm the code seems fine, can you please show the repl? Thanks!
@Bookie0 Here is the screenshot:
Ok try this:

@Bitkoshy
@Bookie0 K will try now!
Tell me if it works! @Bitkoshy
@Bookie0 yep okay testing can we do multiplayer on another repl
No sorry I’m not available now. Did it work tho? If id did,
@Bitkoshy
@Bookie0 pffff lol k i will later I am still working it out
Ok. Hope it works for you! Tell me if you need me, but Im going to sleep soon so maybe tomorrow @Bitkoshy
@Bookie0 If i make yours correct can you vote up for me??
@Bitkoshy That will be the deal hahahaha
Ok @Bitkoshy
Ok @Bitkoshy I did
Thanks for selecting my answer! 😊 @Bitkoshy
@Bookie0 I marked yours an the answer :) Have a goodnight! I am in Australia so yea morning for me!
Cool have a good day! @Bitkoshy
@Bookie0 Yea you too thanks!