So I´ve been coding for around 3 weeks now and made this project wich is a gambling game with a slot machine, number guessing, lottery and a jackpot(wich I made up). so what should I do better and what did I do good at . And sorry if I didn´t make a right format for the code It´s my first post here
# 🍋 🥑 ⭐ 🍇 🍊 🍌 🍎 import random import time wanna_play = True balance = int(input("how much do you want to play with")) icons = ["🍋", "🥑", "⭐", "🍇", "🍊", "🍌", "🍎"] game_decision = input("l for lottery, s for slot machine n for number guessing and j for jackpot") while wanna_play == True: #slot machine starts here if game_decision == "s" or game_decision == "S": print("Welcome to slot machine!") print(f"Your balance is {balance}") row_mark1 = random.choice(icons) row_mark2 = random.choice(icons) row_mark3 = random.choice(icons) row = [] row.append(row_mark1) row.append(row_mark2) row.append(row_mark3) print(*row) if row == "🍋": print("You won 75") balance += 75 elif row == "🥑": print("You won 75") balance += 75 elif row == "🍇": print("You won 75") balance += 75 elif row == "🍊": print("You won 75") balance += 75 elif row == "🍌": print("You won 75") balance += 75 elif row == "🍎": print("You won 75") balance += 75 elif row == "⭐": print("You won 250") balance += 250 elif row_mark1 == "⭐" and row_mark2 == "⭐": print("You won 100") balance += 100 elif row_mark2 == "⭐" and row_mark3 == "⭐": print("You won 100") balance += 100 elif row_mark1 == "⭐" and row_mark3 == "⭐": print("You won 100") balance += 100 elif row_mark1 == "⭐": print("You won 30") balance += 30 elif row_mark2 == "⭐": print("You won 30") balance += 50 elif row_mark3 == "⭐": print("You won 30") balance += 30 balance -= 10 print("q is to quit") game_decision = input("l for lottery, s for slot machine n for number guessing and j for jackpot") if game_decision == "Q" or game_decision == "q": print("Bye!") break #slot machine ends here #number guessing starts here elif game_decision == "n" or game_decision == "N": print("Welcome to number guessing") time.sleep(0.25) print("Your guess needs to be between 0 and 100") print(f"Your balance is {balance}") c_num = random.randint(0, 100) p_num = int(input("put your guess here: ")) if p_num == c_num: print("You won 15") balance += 15 elif p_num < 0 or p_num > 100: print("number invalid") else: print("You lost") print(f"Correct answer would have been {c_num}") balance -= 5 print("q is to quit") game_decision = input("l for lottery, s for slot machine n for number guessing and j for jackpot") if game_decision == "Q" or game_decision == "q": print("Bye!") break #number guessing ends here #lottery starts here elif game_decision == "l" or game_decision == "L": print(f"Your balance is {balance}") print("Welcome to lottery!") print("each one of your numbers in a row needs to be between 0 and 70") lottery_row_input = input("insert your numbers with spaces between them: ") lottery_row = list(map(int, lottery_row_input.split())) lottery_numbers_c = [random.randint(0, 70) for number in range(7)] print(*lottery_row) print() if lottery_row == lottery_numbers_c: print("You won 8 000 000") balance += 8000000 elif lottery_row is not lottery_numbers_c: print("You lost!") balance -= 20 print("q is to quit") game_decision = input("l for lottery, s for slot machine n for number guessing and j for jackpot") if game_decision == "Q" or game_decision == "q": print("Bye!") break #lottery ends here #jackpot starts here elif game_decision == "J" or game_decision == "j": print("Welcome to jackpot!") print(f"Your balance is {balance}") jackpot1 = int(input("first jackpot number from 0 to 100")) jackpot2 = int(input("second jackpot number from 0 to 100")) jackpot3 = int(input("third jackpot number from 0 to 500")) jackpot_row_c = [random.randint(0, 100) for number in range(2)] jackpot3_c = random.randint(0, 500) jackpot_row_c.append(jackpot3_c) jackpot_row = [] jackpot_row.append(jackpot1) jackpot_row.append(jackpot2) jackpot_row.append(jackpot3) if jackpot_row == jackpot_row_c: print("You won 160 000 000") balance += 160000000 elif jackpot_row is not jackpot_row_c: print("You lost!") balance -= 25 game_decision = input("l for lottery, s for slot machine n for number guessing and j for jackpot") if game_decision == "Q" or game_decision == "q": print("Bye!") break #jackpot ends here
submitted by /u/jontsii
[link] [comments]
r/learnpython So I´ve been coding for around 3 weeks now and made this project wich is a gambling game with a slot machine, number guessing, lottery and a jackpot(wich I made up). so what should I do better and what did I do good at . And sorry if I didn´t make a right format for the code It´s my first post here # 🍋 🥑 ⭐ 🍇 🍊 🍌 🍎 import random import time wanna_play = True balance = int(input(“how much do you want to play with”)) icons = [“🍋”, “🥑”, “⭐”, “🍇”, “🍊”, “🍌”, “🍎”] game_decision = input(“l for lottery, s for slot machine n for number guessing and j for jackpot”) while wanna_play == True: #slot machine starts here if game_decision == “s” or game_decision == “S”: print(“Welcome to slot machine!”) print(f”Your balance is {balance}”) row_mark1 = random.choice(icons) row_mark2 = random.choice(icons) row_mark3 = random.choice(icons) row = [] row.append(row_mark1) row.append(row_mark2) row.append(row_mark3) print(*row) if row == “🍋”: print(“You won 75”) balance += 75 elif row == “🥑”: print(“You won 75”) balance += 75 elif row == “🍇”: print(“You won 75”) balance += 75 elif row == “🍊”: print(“You won 75”) balance += 75 elif row == “🍌”: print(“You won 75”) balance += 75 elif row == “🍎”: print(“You won 75”) balance += 75 elif row == “⭐”: print(“You won 250”) balance += 250 elif row_mark1 == “⭐” and row_mark2 == “⭐”: print(“You won 100”) balance += 100 elif row_mark2 == “⭐” and row_mark3 == “⭐”: print(“You won 100”) balance += 100 elif row_mark1 == “⭐” and row_mark3 == “⭐”: print(“You won 100”) balance += 100 elif row_mark1 == “⭐”: print(“You won 30”) balance += 30 elif row_mark2 == “⭐”: print(“You won 30”) balance += 50 elif row_mark3 == “⭐”: print(“You won 30”) balance += 30 balance -= 10 print(“q is to quit”) game_decision = input(“l for lottery, s for slot machine n for number guessing and j for jackpot”) if game_decision == “Q” or game_decision == “q”: print(“Bye!”) break #slot machine ends here #number guessing starts here elif game_decision == “n” or game_decision == “N”: print(“Welcome to number guessing”) time.sleep(0.25) print(“Your guess needs to be between 0 and 100″) print(f”Your balance is {balance}”) c_num = random.randint(0, 100) p_num = int(input(“put your guess here: “)) if p_num == c_num: print(“You won 15”) balance += 15 elif p_num < 0 or p_num > 100: print(“number invalid”) else: print(“You lost”) print(f”Correct answer would have been {c_num}”) balance -= 5 print(“q is to quit”) game_decision = input(“l for lottery, s for slot machine n for number guessing and j for jackpot”) if game_decision == “Q” or game_decision == “q”: print(“Bye!”) break #number guessing ends here #lottery starts here elif game_decision == “l” or game_decision == “L”: print(f”Your balance is {balance}”) print(“Welcome to lottery!”) print(“each one of your numbers in a row needs to be between 0 and 70”) lottery_row_input = input(“insert your numbers with spaces between them: “) lottery_row = list(map(int, lottery_row_input.split())) lottery_numbers_c = [random.randint(0, 70) for number in range(7)] print(*lottery_row) print() if lottery_row == lottery_numbers_c: print(“You won 8 000 000”) balance += 8000000 elif lottery_row is not lottery_numbers_c: print(“You lost!”) balance -= 20 print(“q is to quit”) game_decision = input(“l for lottery, s for slot machine n for number guessing and j for jackpot”) if game_decision == “Q” or game_decision == “q”: print(“Bye!”) break #lottery ends here #jackpot starts here elif game_decision == “J” or game_decision == “j”: print(“Welcome to jackpot!”) print(f”Your balance is {balance}”) jackpot1 = int(input(“first jackpot number from 0 to 100”)) jackpot2 = int(input(“second jackpot number from 0 to 100”)) jackpot3 = int(input(“third jackpot number from 0 to 500”)) jackpot_row_c = [random.randint(0, 100) for number in range(2)] jackpot3_c = random.randint(0, 500) jackpot_row_c.append(jackpot3_c) jackpot_row = [] jackpot_row.append(jackpot1) jackpot_row.append(jackpot2) jackpot_row.append(jackpot3) if jackpot_row == jackpot_row_c: print(“You won 160 000 000”) balance += 160000000 elif jackpot_row is not jackpot_row_c: print(“You lost!”) balance -= 25 game_decision = input(“l for lottery, s for slot machine n for number guessing and j for jackpot”) if game_decision == “Q” or game_decision == “q”: print(“Bye!”) break #jackpot ends here submitted by /u/jontsii [link] [comments]
So I´ve been coding for around 3 weeks now and made this project wich is a gambling game with a slot machine, number guessing, lottery and a jackpot(wich I made up). so what should I do better and what did I do good at . And sorry if I didn´t make a right format for the code It´s my first post here
# 🍋 🥑 ⭐ 🍇 🍊 🍌 🍎 import random import time wanna_play = True balance = int(input("how much do you want to play with")) icons = ["🍋", "🥑", "⭐", "🍇", "🍊", "🍌", "🍎"] game_decision = input("l for lottery, s for slot machine n for number guessing and j for jackpot") while wanna_play == True: #slot machine starts here if game_decision == "s" or game_decision == "S": print("Welcome to slot machine!") print(f"Your balance is {balance}") row_mark1 = random.choice(icons) row_mark2 = random.choice(icons) row_mark3 = random.choice(icons) row = [] row.append(row_mark1) row.append(row_mark2) row.append(row_mark3) print(*row) if row == "🍋": print("You won 75") balance += 75 elif row == "🥑": print("You won 75") balance += 75 elif row == "🍇": print("You won 75") balance += 75 elif row == "🍊": print("You won 75") balance += 75 elif row == "🍌": print("You won 75") balance += 75 elif row == "🍎": print("You won 75") balance += 75 elif row == "⭐": print("You won 250") balance += 250 elif row_mark1 == "⭐" and row_mark2 == "⭐": print("You won 100") balance += 100 elif row_mark2 == "⭐" and row_mark3 == "⭐": print("You won 100") balance += 100 elif row_mark1 == "⭐" and row_mark3 == "⭐": print("You won 100") balance += 100 elif row_mark1 == "⭐": print("You won 30") balance += 30 elif row_mark2 == "⭐": print("You won 30") balance += 50 elif row_mark3 == "⭐": print("You won 30") balance += 30 balance -= 10 print("q is to quit") game_decision = input("l for lottery, s for slot machine n for number guessing and j for jackpot") if game_decision == "Q" or game_decision == "q": print("Bye!") break #slot machine ends here #number guessing starts here elif game_decision == "n" or game_decision == "N": print("Welcome to number guessing") time.sleep(0.25) print("Your guess needs to be between 0 and 100") print(f"Your balance is {balance}") c_num = random.randint(0, 100) p_num = int(input("put your guess here: ")) if p_num == c_num: print("You won 15") balance += 15 elif p_num < 0 or p_num > 100: print("number invalid") else: print("You lost") print(f"Correct answer would have been {c_num}") balance -= 5 print("q is to quit") game_decision = input("l for lottery, s for slot machine n for number guessing and j for jackpot") if game_decision == "Q" or game_decision == "q": print("Bye!") break #number guessing ends here #lottery starts here elif game_decision == "l" or game_decision == "L": print(f"Your balance is {balance}") print("Welcome to lottery!") print("each one of your numbers in a row needs to be between 0 and 70") lottery_row_input = input("insert your numbers with spaces between them: ") lottery_row = list(map(int, lottery_row_input.split())) lottery_numbers_c = [random.randint(0, 70) for number in range(7)] print(*lottery_row) print() if lottery_row == lottery_numbers_c: print("You won 8 000 000") balance += 8000000 elif lottery_row is not lottery_numbers_c: print("You lost!") balance -= 20 print("q is to quit") game_decision = input("l for lottery, s for slot machine n for number guessing and j for jackpot") if game_decision == "Q" or game_decision == "q": print("Bye!") break #lottery ends here #jackpot starts here elif game_decision == "J" or game_decision == "j": print("Welcome to jackpot!") print(f"Your balance is {balance}") jackpot1 = int(input("first jackpot number from 0 to 100")) jackpot2 = int(input("second jackpot number from 0 to 100")) jackpot3 = int(input("third jackpot number from 0 to 500")) jackpot_row_c = [random.randint(0, 100) for number in range(2)] jackpot3_c = random.randint(0, 500) jackpot_row_c.append(jackpot3_c) jackpot_row = [] jackpot_row.append(jackpot1) jackpot_row.append(jackpot2) jackpot_row.append(jackpot3) if jackpot_row == jackpot_row_c: print("You won 160 000 000") balance += 160000000 elif jackpot_row is not jackpot_row_c: print("You lost!") balance -= 25 game_decision = input("l for lottery, s for slot machine n for number guessing and j for jackpot") if game_decision == "Q" or game_decision == "q": print("Bye!") break #jackpot ends here
submitted by /u/jontsii
[link] [comments]