mirror of
https://github.com/Oxbian/CodingGame.git
synced 2025-07-07 04:14:27 +02:00
Adding python files
This commit is contained in:
19
Python/Easy_Challenges/temperatures.py
Normal file
19
Python/Easy_Challenges/temperatures.py
Normal file
@ -0,0 +1,19 @@
|
||||
import sys
|
||||
import math
|
||||
|
||||
n = int(input()) # the number of temperatures to analyse
|
||||
min = float('inf')
|
||||
for i in input().split():
|
||||
# t: a temperature expressed as an integer ranging from -273 to 5526
|
||||
t = int(i)
|
||||
if (abs(0-t) < abs(0-min)):
|
||||
min = t
|
||||
elif min == t:
|
||||
min = t
|
||||
elif abs(min) == abs(t):
|
||||
min = abs(min)
|
||||
|
||||
if (min == float('inf')):
|
||||
print(0)
|
||||
else:
|
||||
print(min)
|
Reference in New Issue
Block a user