Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import random as rand
  2. resolvido = False
  3.  
  4. def gera_3_valores():
  5. return rand.sample(range(0, 9), 3)
  6.  
  7. while not resolvido:
  8. valores = gera_3_valores()
  9. x = valores[0]
  10. y = valores[1]
  11. z = valores[2]
  12. print("x: {}, y: {}, z: {}".format(x, y, z))
  13. valor = int(str(x) + str(y) + str(z))
  14. solucao = (valor * 3)
  15. if solucao == int(str(z) + str(z) + str(z)):
  16. resolvido = True
  17. print("{}{}{} * 3 = {}".format(x, y, z, solucao))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement