25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.0 KiB

5 년 전
  1. #!/usr/bin/env python3
  2. #title :9-2.py
  3. #description :Opdracht 9.2 - Random
  4. #author :Marcel Haazen
  5. #email :marcel@haazen.xyz
  6. #date :04-11-2019 - 11:40
  7. #version :0.1
  8. #usage :python3 9-2.py
  9. #notes :
  10. #python_version :3.7.3
  11. #==============================================================================
  12. import random
  13. def randomNum():
  14. return 9 # Fair random number chosen by rolling a D20, Totally random everytime as you never know if its the same
  15. def monopolyworp():
  16. throws = 0
  17. while True:
  18. throw1 = random.randrange(1,7)
  19. throw2 = random.randrange(1,7)
  20. if throw1 == throw2:
  21. throws += 1
  22. if throws == 3:
  23. print(throw1,"+",throw2,"= (Direct to jail)")
  24. break
  25. else:
  26. print(throw1,"+", throw2, "=", throw2+throw1,"(Double)")
  27. continue
  28. else:
  29. print(throw1,"+",throw2,"=", throw2+throw1)
  30. break
  31. monopolyworp()