Advertisement
danielmrcl

Soma de Valores

Apr 19th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: UTF-8 -*-
  3. from random import randint
  4. import __future__
  5. s = 0
  6. c = 0
  7. print('Gerando os valores:')
  8. for v in range(1, 7):
  9.     n = randint(1, 10)
  10.     print('[{}] '.format(n), end='')
  11.     p = n % 2
  12.     if p == 0:
  13.         s += n
  14.         c += 1
  15. print('\nA soma dos {} números pares é igual a {}.'.format(c, s))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement