Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. while True:
  2.     try:
  3.         numVezes = raw_input()
  4.         if 0 < int(numVezes) <= 50:
  5.             break
  6.         else: print "Entrada invalida."
  7.     except:
  8.         print "Entrada invalida."
  9.  
  10. soma, contador = 0, 0
  11. while True:
  12.     try:
  13.         numero = raw_input()
  14.         contador += 1
  15.         if abs(int(numero)) <= 5000:
  16.             soma += int(numero)
  17.         if contador == int(numVezes):
  18.             print soma
  19.             break
  20.     except:
  21.         print "Entrada invalida."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement