Ich glaube, nach fast zwei Jahren kann man eine mögliche Lösung bedenkenlos posten.
# Roulette-Simulation in PYTHON
import random
# c:color 0=black, 1=red
# return 1:won, 0:lost
def roulette(c):
b=random.randint(0,32)
if b==0:
return 0
elif (b%2==0 and c==1) or (b%2!=0 and c==0):
return 1
else:
return 0
def play(n,k):
wins=0
for nn in range(n):
for kk in range(k):
wins += roulette(random.randint(0,1))
return wins
n = int(input('Enter n: '))
k = int(input('Enter k: '))
e = int(input('Enter e: '))
random.seed()
w=play(n,k)
t=n*k
eg=t*e
g=w*e*2
print(f'Spiele total:{t} Spiele gewonnen:{w} Einsatz total:{eg} Gewinn:{g}')

Softwareentwickler, Punkte: 10
welche Programmiersprache?
─ jupiter 05.12.2021 um 20:39