Skip to content

Instantly share code, notes, and snippets.

@SirmaXX
Created February 2, 2021 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SirmaXX/cb6e293588d0de8245bbbe33b7d6d9b3 to your computer and use it in GitHub Desktop.
Save SirmaXX/cb6e293588d0de8245bbbe33b7d6d9b3 to your computer and use it in GitHub Desktop.
milli piyango çekilişi için uygulama
import random
#cekilen top sayisi
topsayisi=7
#1 den n e kadar sayı üstsinir=n
üstsinir=90
#her kolon icin alınan ücret
kolonfiyati=3
#büyük ikramiye miktarları
bikramiye=5000000
#kullanıcının bileti
kullanicirakam=[1,2,3,4,1,2,2]
#kazanan bilet numaraların olduğu liste
rakamlar = []
#piyangoyu kazanan biletin ve bilet fiyatını bulan fonksiyonu
def cekilis(topsayisi,üstsinir):
ucret=0
for x in range(topsayisi):
numara = (random.randint(1, üstsinir))
rakamlar.append(numara)
ucret +=kolonfiyati
return ucret
#top cekilis fonksiyonu
def topcekilis(topsayisi,üstsinir):
olasilik=1
for x in range(topsayisi):
olasilik = olasilik *(1/üstsinir)
üstsinir=üstsinir-1
return (olasilik)
#beklenen değer
def ExpValue(ucret,olasilik,bikramiye):
print("kazancın ortalaması")
print(ucret*olasilik*bikramiye )
print("\n")
#biletin tutup tutmadığını gösteren fonksiyon
def biletkontrol(rakamlar,kullanicirakam):
if(rakamlar==kullanicirakam):
print("kazandiniz")
else :
print("kazanamadınız")
#ana fonksiyon
def main():
ucret = cekilis(topsayisi,üstsinir)
olasilik= topcekilis(topsayisi,üstsinir)
ExpValue(ucret,olasilik,bikramiye)
biletkontrol(rakamlar,kullanicirakam)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment