slot_equo.py

Created by gianfranco-oddenino

Created on January 14, 2025

401 Bytes

Simulatore di una slot machine con gioco equo.
Vengono simulate 100 giocate su 3 ruote con 6 simboli numerici.
Al termine viene visualizzato il totale vinto/perso.


from random import *

# s contiene la cifra spesa/vinta
s=0
# simulo 100 giocate
for i in range(100):
  # spendo 1 euro
  s-=1
  # 3 numeri casuali da 1 a 6
  a=randint(1,6)
  b=randint(1,6)
  c=randint(1,6)
  # si vince con 3 numeri uguali
  if a==b==c:
    # vinco 36 euro: gioco equo
    s+=36
    print(a,b,c," vinto")
  else:
    print(a,b,c)

# cifra totale spesa/vinta
print(s)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.