Предмет: Информатика,
автор: romanom1998
Напишите программу, которая считывает целое число и выводит текст, аналогичный приведенному в примере. (на Python)
входные данные
179
выходные данные
The next number for the number 179 is 180.
The previous number for the number 179 is 178.
программа
n= int(input())
print ('The next number for the number', n,'is',n+1,'.')
print ('The previous number for the number',n,'is',n-1,'.')
вопрос: как сделать так, чтобы точка выводилась без отступления
Ответы
Автор ответа:
72
Самый простой вариант такой:
n= int(input())
print ('The next number for the number', n,'is',str(n+1)+'.')
print ('The previous number for the number',n,'is',str(n-1)+'.')
n= int(input())
print ('The next number for the number', n,'is',str(n+1)+'.')
print ('The previous number for the number',n,'is',str(n-1)+'.')
Автор ответа:
61
Требуется передать в print последним параметром sep = ''.
Программа
n= int(input())
print ('The next number for the number ', n,' is ',n+1,'.', sep = '')
print ('The previous number for the number ',n,' is ',n-1,'.', sep = '')
Программа
n= int(input())
print ('The next number for the number ', n,' is ',n+1,'.', sep = '')
print ('The previous number for the number ',n,' is ',n-1,'.', sep = '')
romanom1998:
так все станут без пробела, или я что-то не так понял?
Похожие вопросы
Предмет: Математика,
автор: teltelefon375
Предмет: Химия,
автор: ggg361290
Предмет: Русский язык,
автор: maksatbekmejmanbekov
Предмет: Математика,
автор: Innamas