repl.it
@FluffyHero/

Random number generator

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import random

value = 0
higherThan60 = 0
lowerThan60 = 0
numberOfTries = 2000
percentage = 100

for x in range(numberOfTries):
  value = random.randrange(1,101,2)
  if(value <= 60):
    lowerThan60 += 1
  if(value > 60):
    higherThan60 += 1

print('Celkovy pocet pokusu:',numberOfTries)
print('Pocet pokusu mensich jak 60(vcetne):',lowerThan60)
print('Pocet pokusu vetsich jak 60:',higherThan60)
print('Procentualni sance:')
print('Mensi nez 60:',(lowerThan60/numberOfTries)*percentage,'%')
print('Vetsi nez 60:',(higherThan60/numberOfTries)*percentage,'%')
Fetching token
?