Hello I googled it and could not find an answer to this
I have to take input from the user then the operator has to print what number is before the input and after the input like:
input= 3
has to print 2 and 4
please help
I used range did I do it wrong I am just a beginner in python please help!!!
number=int(input)
for num in range(number ,+ 1, -1):
print(num)
>Solution :
You first need to use input()
to let the user register a number.
Then, simply print the number with number - 1
and number + 1
.
number = int(input("What is your number? "))
print(f"{number - 1} {number + 1}")
Outputs to:
What is your number? 3
2 4