forked from igortereshchenko/amis_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask5.py
More file actions
19 lines (15 loc) · 997 Bytes
/
Copy pathtask5.py
File metadata and controls
19 lines (15 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""
Умова: Напишіть програму, яка зчитує ціле число і друкує його попереднє і наступне значення за форматом:
The next number for the number 179 is 180.
The previous number for the number 179 is 178.
Вхідні дані: ціле число
Вихідні дані: два рядки за наведеним у завдання форматом.
"""
# Програма виводить попереднє і наступне числа для введеного.Конструкція
#try-except перевіряє на правильність тип введеної користувачем інформації.
try:
numb = int(input("Введіть ціле число "))
print("The next number for the number %d is %d." % (numb , numb+1))
print("The previous number for the number %d is %d." % (numb , numb-1))
except ValueError:
print("Не коректне значення")