fork download
  1. suma = 0
  2.  
  3. while True:
  4. try:
  5. liczba = int(input())
  6. if liczba < 0:
  7. suma += liczba
  8. except:
  9. break
  10.  
  11. print("Suma ujemnych:", suma)
Success #stdin #stdout 0.07s 14144KB
stdin
-5
-6
-9
2
4
5
stdout
Suma ujemnych: -20