Write a program that prints the temperature closest to 0 among input data. If two numbers are equally close to zero, positive integer has to be considered closest to zero (for instance, if the temperatures are -5 and 5, then display 5).
[python]
import sys
import math
n = input()
tempsInput = input().split()
temps = [int(x) for x in tempsInput]
temps_abs = [abs(int(x)) for x in tempsInput]
if not tempsInput:
print(len(tempsInput))
else:
minT = min(temps_abs) maxT = max(temps) result = minT if (minT and maxT > 0) else maxT print(result)
[/python]
Прошлые записи
- Эволюция веб-приложений. От статичного HTML до Single Page Application и Progressive Web Application
- Переезд в Калининград
- Была ли спецоперация на Украине неизбежна?
- О serverless технологии для чатботов
- Свободное время на улучшение блога
- o-zhizni-v-kaliningrade-spustya-god
- Продажа гаража из другого города
- В Калининграде спустя полгода
- Выйти на работу или сидеть дома
- Теперь мы живем в старой немецкой квартире и счастливы
- Как за один день найти жилье в августе 2020 (после пандемии) и чуть не остаться на улице с двумя детьми