SHARE
TWEET

Soma de Valores

danielmrcl Apr 19th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top