Facebook
From ManfredMacx, 4 Years ago, written in Python.
This paste is a reply to rzut_moneta from bumelante - view diff
Embed
Download Paste or View Raw
Hits: 389
  1. # rzut moneta
  2. # generuje 100 rzutow moneta i podaje liczbe orzelkow i reszek
  3.  
  4. import random
  5.  
  6. orzel = 0
  7. reszka = 0
  8. suma = 0
  9.  
  10. while suma < 100:
  11.     rzut = random.randint(1,2)
  12.     suma += 1
  13.  
  14.   if rzut == 1:
  15.       orzel += 1
  16.      
  17.  
  18.   if rzut == 2:
  19.       reszka += 1
  20.    
  21.  
  22. print ("rzuciles moneta", suma, "razy")  
  23. print ("\norzel wypadl", orzel, "razy, a reszka", reszka, "razy")
  24.  
  25. input("\n\nPress the enter key to exit.")
  26.  
  27.