Posted By

maturanti19 on 05/22/19


Tagged

python a kocky najmensie najvacsie cislo


Versions (?)

hracie kocky a random cisla minimum a maximum


 / Published in: Python
 

Vytvorte random pole a zoradte ho podla najvacsieho a a najmensieho

  1. from random import *
  2.  
  3. def randomcisla(n):
  4. global z
  5. z=[]
  6. for i in range(n):
  7. z=z+[randrange(-100,110)]
  8. mini = z[0]
  9. for i in range(len(z)):
  10. if mini > z[i]:
  11. mini = z[i]
  12. print(mini)
  13. maxi = z[0]
  14. for i in range(len(z)):
  15. if maxi < z[i]:
  16. maxi = z[i]
  17. print(maxi)
  18. print(z)
  19. randomcisla(10)
  20.  
  21.  
  22. def hraciakocka1(x):
  23. k=[0]*6
  24. for i in range (x):
  25. h=randrange(1,7)
  26. k[h-1]=k[h-1]+1
  27. print(k)
  28.  
  29. x=int(input('Zadaj kolko krat mam hadzat: '))
  30. hraciakocka1(x)
  31.  
  32. def hraciakocka2(x):
  33. k=[0]*6
  34. for i in range (x):
  35. h=randrange(1,7)
  36. k[h-1]=k[h-1]+1
  37. print(k)
  38.  
  39. x=int(input('Zadaj kolko krat mam hadzat: '))
  40. hraciakocka2(x)

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: milessmith on May 27, 2019

Thanks for sharing.I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one. https://notepad.software/ https://filezilla.software/ https://vidmate.onl/download/

You need to login to post a comment.