/ Published in: Python

sucet cisiel spriemerovany random cisla hladaj cislo ktore zadal uzivatel
Expand |
Embed | Plain Text
from random import * def randomcisla(n): global z z=[] for i in range(n): z=z+[randrange(0,11)] print(z) randomcisla(8) def spriemerovany_sucet(): global m m=0 for i in range(len(z)): m=m+z[i] print('Sucet tychto cisel je: '+ str(m)) global priemer priemer = m/len(z) print('Priemer tychto cisel je: ' + str(priemer)) mensie=[] for i in range(len(z)): if priemer > z[i]: print(z[i]) spriemerovany_sucet() def hladaj_cislo(x): randomcisla(20) pozicie=[] for i in range(len(z)): if x==z[i]: pozicie=pozicie+[i+1] if pozicie==[]: print('Nasiel som!') else: print('Nasiel som! Su na poziciach: ') print(pozicie) x=int(input('Zadaj cislo ake mam hladat: ')) hladaj_cislo(x)
Comments

You need to login to post a comment.
Im in love with your content and also gain some knowledge from your blog.
Best Quiet Air Compressors