HELP ME!!!!!!!!!!!!!!!

So I was trying to write this code for this situation:

Write a program that reads an integer number and prints its previous and next numbers

To solve this I wrote a code that had two different variables, one for the previous number and one for the next number. It looked like this:

a = int(input())
previous = a - 1
next = a + 1

So I'm trying to print the entire statement "The number after 180(ex) is 179" in one line. To do this, I typed:

print ("the number after " + a + "is " + previous)

Whenever I try to test this, the server always states that I need to change 'str' to 'int'. I do not know what to do for this issue. I'm new. Help me please.

You are viewing a single comment. View All
Answered by CoolqB (150) [earned 5 cycles]
View Answer
leon332157 (217)

Because + in Python is for adding strings. U can either convert the int into a string, or use ',' instead of '+' .