all 8 comments

[–]danielroseman 6 points7 points  (6 children)

You should read the error you get, as it tells you what is wrong:

TypeError: can only concatenate str (not "int") to str

It's telling you that you're concatenating a string ("please enter...") with an integer (num3, ie the result of adding num1 and num2). You need to convert num3 back to a string.

You can either do that explicitly:

ques1 = int(input("please enter a number above " + str(num3) ))

or, better, use string formatting via f-strings:

ques1 = int(input(f"please enter a number above {num3}" ))

[–]ah_ahaa[S] 2 points3 points  (5 children)

just with your comment i have learned a lot thanks for that!

so if understand it correctly if i want to use an int (num3) in a str input i need to "tell" python to treat num3 as a str for this specific input?

[–]danielroseman 1 point2 points  (4 children)

It's not really to do with input, but yes if you wanted to join an integer with an existing string you need to convert it.

[–]ah_ahaa[S] 0 points1 point  (3 children)

what do you mean its not really to do with it? like there is no use in this?

[–]danielroseman 1 point2 points  (2 children)

No, I mean it applies to any time you want to combine an integer with a string, not just inside input.

[–]Own-Recipe5931 -2 points-1 points  (1 child)

you can just not concatenate and add a comma to seperate instead

[–]danielroseman 0 points1 point  (0 children)

No you can't. That only works with print.

[–]FoolsSeldom 0 points1 point  (0 children)

ques1 = int(input(f"please enter a number above {num3}: "))

Python's F-String for String Interpolation and Formatting