Advertisement
Guest User

Tempuratures fixed :P

a guest
Sep 7th, 2021
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import sys
  2. import math
  3.  
  4. n = int(input())  # the number of temperatures to analyse
  5. closest_temp = 5527
  6. closest_real_temp = 0
  7. unsign_temp = 0
  8. for i in input().split():
  9.     # t: a temperature expressed as an integer ranging from -273 to 5526
  10.     t = int(i)
  11.     if t > 0 and closest_real_temp < 0:
  12.         if -t == closest_real_temp:
  13.             closest_real_temp = t
  14.     else:
  15.    
  16.         if t < 0:
  17.             unsign_temp = -t
  18.  
  19.         else:
  20.             unsign_temp = t
  21.         if unsign_temp < closest_temp:
  22.             closest_temp = unsign_temp
  23.             closest_real_temp = t
  24. print(closest_real_temp)
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement