Facebook
From bumelante, 4 Years ago, written in Python.
Embed
Download Paste or View Raw
Hits: 554
  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.  

Replies to rzut_moneta rss

Title Name Language When
Re: rzut_moneta dasf python 4 Years ago.
Re: rzut_moneta ManfredMacx python 4 Years ago.