Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- from datetime import date
- def randomNumber(rangeNum, modeCount):
- randomNum = []
- randomNum.clear()
- for num in range(50):
- random1 = random.randint(1, modeCount)
- if randomNum.count(random1) > 0:
- randomNum.remove(random1)
- elif len(randomNum) == rangeNum:
- break
- else:
- randomNum.append(random1)
- return randomNum
- def game(gameModes, counts, price, prevWin, countMode):
- global priceAll
- lotto = []
- print("-------------------------------------Welcome to "+gameModes+" Lotto--------------------------------------", "\nLotto price money: " + str(price))
- for num in range(1000):
- count = len(lotto)
- if count < 1:
- number = int(input("Enter a number("+str(counts + 1)+"): \n"))
- else:
- number = int(input("Enter next number("+str(counts + 1 - count)+"): \n"))
- if lotto.count(number) > 0:
- print("ERROR! Cannot enter the same value")
- elif number > countMode:
- print("ERROR! Cannot enter number higher than "+str(countMode))
- elif number <= 0:
- print("ERROR! Cannot enter number less than 1")
- elif count >= counts:
- lotto.append(number)
- print("------------------------------------------------------------------------------------------------\n" + "Here are your entered number: " + str(lotto), "\nWinning balls are shuffling...")
- time.sleep(2)
- print("Here are winning numbers!!", str(prevWin), "\n------------------------------------------------------------------------------------------------", "\nYour numbers: " + str(lotto), "\nWinning numbers: " + str(prevWin))
- time.sleep(2)
- if str(prevWin) == str(lotto):
- print("YOU WIN!")
- if counts == 2:
- priceAll = 10000
- elif counts == 5:
- priceAll = 1000
- print("Curent price: " + str(priceAll))
- time.sleep(2)
- else:
- priceAll = price + 500
- print("------------------------------------------------------------------------------------------------\n" + "AW SNAP! TRY AGAIN NEXT TIME!!", "\nCurent price: " + str(priceAll))
- time.sleep(2)
- ask = input("------------------------------------------------------------------------------------------------\n" + "Try Again? (Y/N)\n")
- if ask == "Y" or ask == "y":
- return price
- elif ask == "N" or ask == "n":
- exit()
- elif number <= countMode:
- lotto.append(number)
- print(lotto)
- def main():
- print("--------------------------------------Welcome to IT-Lotto!--------------------------------------")
- a = 1
- price642, price645, price649, price3 = 1000, 1000, 1000, 10000
- while True:
- print("------------------------------------------------------------------------------------------------"+"\nYesterday's Winning numbers:")
- if a == True:
- print("In 6/42: ",randomNumber(6,42)," Price: ",price642,"\nIn 6/45: ",randomNumber(6,45)," Price: ",price645, "\nIn 6/49: ",randomNumber(6,49)," Price: ",price649, "\nIn Lucky Three: ",randomNumber(3,9),"Price: ",price3)
- else:
- print("In 6/42: ", str(prevWin1), " Price: ", price642, "\nIn 6/45: ", str(prevWin2), " Price: ", price645, "\nIn 6/49: ", str(prevWin3), " Price: ", price649, "\nIn Lucky3: ", str(prevWin4), "Price: ", price3)
- today = date.today()
- prevWin1, prevWin2, prevWin3, prevWin4 = randomNumber(6, 42), randomNumber(6,45), randomNumber(6,49), randomNumber(3, 9)
- mode = int(input("----------------------------------- Today's date:"+ str(today)+ "-------------------------------------" +"\nSELECT PLAYING MODE:"+"\n(1) - 6/42 Lotto (2) - 6/45 Mega Lotto (3) - 6/49 Super Lotto (4) - Lucky Three Numbers :\n"))
- if mode == 1:
- game("6/42", 5, price642, prevWin1,42)
- price642 = priceAll
- elif mode == 2:
- game("6/45", 5, price645, prevWin2,45)
- price645 = priceAll
- elif mode == 3:
- game("6/49", 5, price649, prevWin3,49)
- price649 = priceAll
- elif mode == 4:
- game("Lky3", 2, price3, prevWin4,9)
- price3 = priceAll
- a = False
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement