# Python Slot Machine import random def spin_row(): symbols = ['🍒', '🍉', '🍋', '🔔', '⭐'] return [random.choice(symbols) for _ in range(3)] def print_row(row): print("**************") print(" | ".join(row)) print("**************") def get_payout(row, bet): if row[0] == row[1] == row[2]: if row[0] == '🍒': return bet * 3 elif row[0] == '🍉': return bet * 4 elif row[0] == '🍋': return bet * 5 elif row[0] == '🔔': return bet * 10 elif row[0] == '⭐': return bet * 20 return 0 def main(): balance = 100 print("*************************") print("Welcome to Python Slots ") print("Symbols: 🍒 🍉 🍋 🔔 ⭐") print("*************************") while balance > 0: print(f"Current balance: ${balance}") bet = input("Place your bet amount: ") if not bet.isdigit(): print("Please enter a valid number") continue bet = int(bet) if bet > balance: print("Insufficient funds") continue if bet 0: print(f"You won ${payout}") else: print("Sorry you lost this round") balance += payout play_again = input("Do you want to spin again? (Y/N): ").upper() if play_again != 'Y': break print("*******************************************") print(f"Game over! Your final balance is ${balance}") print("*******************************************") if ___name___ == '__main__': main()
Much easier to follow for this newbie. Looking forward to coding myself and maybe looking for improvements. Especially loved the use of emojies - it's the pretty colors and noises that keep the punters coming back!
I wish I had someone I could count on in life. I have studied beyond just web design but I'm not getting simple freelance gigs to do. Sometimes I ask myself that is it because I don't have a certificate.
You know, only a real Chad would teach people how to code in several languages and end the series by teaching us assembly. Just saying. Throw back languages would be pretty dope. I hear COBOL still has business because of the U.S. banking system and military.
hey, results = [] for symbols in range (3): results.append(random.choice(symbols)) return results this code that you showed as an option outputs object error.
I need help guys if you can help me in any way to get me a job or get a new laptop for me please I would appreciate. Cuz at this moment only hope is my portion
# Python Slot Machine
import random
def spin_row():
symbols = ['🍒', '🍉', '🍋', '🔔', '⭐']
return [random.choice(symbols) for _ in range(3)]
def print_row(row):
print("**************")
print(" | ".join(row))
print("**************")
def get_payout(row, bet):
if row[0] == row[1] == row[2]:
if row[0] == '🍒':
return bet * 3
elif row[0] == '🍉':
return bet * 4
elif row[0] == '🍋':
return bet * 5
elif row[0] == '🔔':
return bet * 10
elif row[0] == '⭐':
return bet * 20
return 0
def main():
balance = 100
print("*************************")
print("Welcome to Python Slots ")
print("Symbols: 🍒 🍉 🍋 🔔 ⭐")
print("*************************")
while balance > 0:
print(f"Current balance: ${balance}")
bet = input("Place your bet amount: ")
if not bet.isdigit():
print("Please enter a valid number")
continue
bet = int(bet)
if bet > balance:
print("Insufficient funds")
continue
if bet 0:
print(f"You won ${payout}")
else:
print("Sorry you lost this round")
balance += payout
play_again = input("Do you want to spin again? (Y/N): ").upper()
if play_again != 'Y':
break
print("*******************************************")
print(f"Game over! Your final balance is ${balance}")
print("*******************************************")
if ___name___ == '__main__':
main()
Is Bro Code your real name
line 80, in
if _name_ == '__main__':
NameError: name '_name_' is not defined. Did you mean: '__name__'?
@@MC_Transportlol it's not it's just an internet alias
@@NerkoVukovicjust do '__name__' whenever that happens just follow the error code
how to repeat input("Do you want to spin again? (Y/N): ").upper() if that is not alpha or not y and n
bro is brother, bro is helper , bro is savior, bro is teacher, bro is legend . Love you bro
Thanks Bro. You’re a huge help. I gotta say your videos have to be the easiest to follow and your organization is impeccable.
Thanks man, projects really help me speed up my learning proces.
Simply the best channel in youtube . straight to the point and no one doesnt understand him .
Not only did i learn more about coding, i got a free lesson on why not to gamble 😀
Had the same thought 😊
Bro, I really enjoyed this, thank you. I learn and retain by doing projects like this. You are a gem
Much easier to follow for this newbie. Looking forward to coding myself and maybe looking for improvements. Especially loved the use of emojies - it's the pretty colors and noises that keep the punters coming back!
Bro code is my 3rd most favourite coding teacher on entire UA-cam ❤️🔥🗿
Who are the other two?
@@spenceragain 1st code with Harry 2nd the code mentor
99% of programmers quit before hitting the subscribe button
LET GO GAMBLING
**strange sound** oh dang it
**strange sound** oh dang it
**strange sound** oh dang it
**strange sound** oh dang it
😂😂
Awesome video. Don't gamble folks 😂
Just say bet = int(input("Place your bet amount: ) so you don't have to take the extra step and convert the string.
Love all your videos !!! Could you also do tutorials for Flutter pls . Thanks
thank you for your tutorials I love your videos
Wowwww.... What a wonderful way of importing fruits
👌👌
Bro when are you live on twitch I need to sub to you as a thank you for all these amazing free lessons
Can u explain algorithms and data structure in python , because ur explanations are the best .
I love all your work thank you❤️❤️❤️
Can you show how to do the shortcuts like for random module at 9:00 please.
Bro is a genius 🧠🧠🧠👏 thank you
Excellent Job Sir❤❤❤❤
Bro almost became a gambling addict
Bro is back to python 😊
This was so fun thanks for video 😂👍
Sit back relax and enjoy
Thanks Bro Free Education
Bro make videos on express js , node js
I wish I had someone I could count on in life. I have studied beyond just web design but I'm not getting simple freelance gigs to do. Sometimes I ask myself that is it because I don't have a certificate.
Hey Bro, would you be able to do an updated video of C#?
And when are you streaming again?!
Bro please make an updated version of the python full course just like the js one
Awesome vid
I recreated this program by myself. Thanks bro for this amazing video
import random
def create_row():
return [random.choice(['🍒', '🍉', '🍊', '🔔', '⭐']) for _ in range(3)]
def print_row(row):
print("
***************")
print(f" {row[0]} | {row[1]} | {row[2]} ")
print("***************
")
def bet(balance):
amount = int(input("Enter the amount to bet : "))
if amount > balance:
print("Insufficient funds")
elif amount < 0:
print("Amount cannot be negative.")
else:
return amount
return -1
def pay(row, bet_amount):
if row[0] == row[1] == row[2]:
print("You Won!")
amount_earned = 0
if row[0] == '🍒':
amount_earned = 3 * bet_amount
elif row[0] == '🍉':
amount_earned = 4 * bet_amount
elif row[0] == '🍊':
amount_earned = 5 * bet_amount
elif row[0] == '🔔':
amount_earned = 10 * bet_amount
elif row[0] == '⭐':
amount_earned = 20 * bet_amount
else:
amount_earned = 0
print(f"Amount Earned : ₹{amount_earned}")
return amount_earned
else:
print("You Lose!")
return 0
def main():
print("-------------------------")
print(" Slot Machine ")
print("-------------------------")
balance = 1000
running = True
while running and balance > 0:
print(f"Your balance : ₹{balance}")
spin = input("Do you want to spin? (y/n): ")
if not spin == 'y':
running = False
continue
bet_amount = bet(balance)
if bet_amount == -1:
continue
else:
balance -= bet_amount
row = create_row()
print_row(row)
balance += pay(row, bet_amount)
print("Thanks for playing! We looted all your money :)")
if __name__ == '__main__':
main()
Purpose of return -1 please...?? Actually why did you used in the code
hey i really love your videos, I was wondering if you could make a video about "matlab".
Sir please continue and complete the react course
It would be nice if you make a Mongoose video series.
ai this gave me insperation want to try it in c, thanks bigbro
Broo can you make a video about Regular Expressions in Python
Cool blud keep winning love ya
Thank you boss its been a while I guess I have missed a lot
@BroCodez
do data structures in panda
pleasee love ur vids .....
🙌
Can you do ISpalindrome method/reverse string in c#?
Make an assembly course🙂!
bro already sound like gigachad
Make a go language Playlist please
Is this going in the 12 Hour course?
its already out several years ago, it will not get added
Bro Please Explain Django and Flask
Try to.make videos for node js bro it is a upcoming source library
thanks bro code
we need a kotlin tutorial
Please Bro do a full course of Kotlin.
My bro, help me understand the express node js module!
like if u want more react tutorial
GAMBLEING YEAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
can we add these project in our cv
My laptop spoilt so I was not able to follow up with the good content and build my carrier
Nothing seems to be working for me. The part of the world I find myself is very tough.
i copied everything but theres a bug in line 49, 45, 8 I'm using python 3.9.6
You know, only a real Chad would teach people how to code in several languages and end the series by teaching us assembly. Just saying. Throw back languages would be pretty dope. I hear COBOL still has business because of the U.S. banking system and military.
pls type hinting 4 python
Kotlin please
Nothing seems to be working for me. I'm frustrated in life cuz after all nobody got my back. I have given up my best for this carrier but still.
Relax buddy
hey,
results = []
for symbols in range (3):
results.append(random.choice(symbols))
return results
this code that you showed as an option outputs object error.
I need help guys if you can help me in any way to get me a job or get a new laptop for me please I would appreciate. Cuz at this moment only hope is my portion
Bro Code pls do C++ full course with Unreal Engine (making a game)
Gamblemaxxing
🫡🫡🫡🫡🫡🗿
__name__