# 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()
@MC_Transport6 ай бұрын
Is Bro Code your real name
@NerkoVukovic6 ай бұрын
line 80, in if _name_ == '__main__': NameError: name '_name_' is not defined. Did you mean: '__name__'?
@MedakitOwO6 ай бұрын
@@MC_Transportlol it's not it's just an internet alias
@MedakitOwO6 ай бұрын
@@NerkoVukovicjust do '__name__' whenever that happens just follow the error code
@user-ze5vx6vf3n6 ай бұрын
how to repeat input("Do you want to spin again? (Y/N): ").upper() if that is not alpha or not y and n
@towsifbillah8346 ай бұрын
bro is brother, bro is helper , bro is savior, bro is teacher, bro is legend . Love you bro
@cantbeserious412016 күн бұрын
Thanks Bro. You’re a huge help. I gotta say your videos have to be the easiest to follow and your organization is impeccable.
@paraglide016 ай бұрын
Thanks man, projects really help me speed up my learning proces.
@cruyffsworld97316 ай бұрын
Simply the best channel in youtube . straight to the point and no one doesnt understand him .
@motomadman5736 ай бұрын
Not only did i learn more about coding, i got a free lesson on why not to gamble 😀
@kapibara24405 ай бұрын
Had the same thought 😊
@alan-overthenet6 ай бұрын
Bro, I really enjoyed this, thank you. I learn and retain by doing projects like this. You are a gem
@TheCommunistRabbit6 ай бұрын
99% of programmers quit before hitting the subscribe button
@b.ka7med1146 ай бұрын
LET GO GAMBLING **strange sound** oh dang it **strange sound** oh dang it **strange sound** oh dang it **strange sound** oh dang it
@PersonalEmail-ot1bq5 ай бұрын
😂😂
@dmays676 ай бұрын
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!
@sreedarshinikannan4676 ай бұрын
Love all your videos !!! Could you also do tutorials for Flutter pls . Thanks
@dariuss.42746 ай бұрын
thank you for your tutorials I love your videos
@HacknCodeOffical6 ай бұрын
Bro code is my 3rd most favourite coding teacher on entire KZbin ❤️🔥🗿
@spenceragain6 ай бұрын
Who are the other two?
@HacknCodeOffical6 ай бұрын
@@spenceragain 1st code with Harry 2nd the code mentor
@kingshahzad783 ай бұрын
Wowwww.... What a wonderful way of importing fruits 👌👌
@Stace-os6iq6 ай бұрын
I love all your work thank you❤️❤️❤️
@zenogaylord78696 ай бұрын
Bro when are you live on twitch I need to sub to you as a thank you for all these amazing free lessons
@InnnocentladSMCtradinghub6 ай бұрын
Sit back relax and enjoy
@shricharanramesh71495 ай бұрын
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()
@GayatriMagapuАй бұрын
Purpose of return -1 please...?? Actually why did you used in the code
@kingshahzad783 ай бұрын
Excellent Job Sir❤❤❤❤
@JassersChannel5 ай бұрын
Bro almost became a gambling addict
@paraglide016 ай бұрын
Can you show how to do the shortcuts like for random module at 9:00 please.
@CrispyandCalmm6 ай бұрын
Thanks Bro Free Education
@enemdes37356 ай бұрын
This was so fun thanks for video 😂👍
@cruyffsworld97316 ай бұрын
Can u explain algorithms and data structure in python , because ur explanations are the best .
@siciliandragon86543 ай бұрын
Just say bet = int(input("Place your bet amount: ) so you don't have to take the extra step and convert the string.
@nishawnbeckford26366 ай бұрын
Awesome vid
@GamerDevIND6 ай бұрын
Bro is back to python 😊
@dysoneducationАй бұрын
Bro is a genius 🧠🧠🧠👏 thank you
@RajaPatel-h3t6 ай бұрын
Bro make videos on express js , node js
@3minutesbibletruth6 ай бұрын
Thank you boss its been a while I guess I have missed a lot
@exactmidnight6 ай бұрын
Cool blud keep winning love ya
@technicalswag39256 ай бұрын
Sir please continue and complete the react course
@NightMare-hi7vu6 ай бұрын
Bro please make an updated version of the python full course just like the js one
@AukeiHD6 ай бұрын
hey i really love your videos, I was wondering if you could make a video about "matlab".
@Jordan-qi2dn6 ай бұрын
Hey Bro, would you be able to do an updated video of C#? And when are you streaming again?!
@Bumblevie_6 ай бұрын
thanks bro code
@3minutesbibletruth6 ай бұрын
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.
@gordon21616 ай бұрын
Is this going in the 12 Hour course?
@olivergrim76346 ай бұрын
its already out several years ago, it will not get added
@bjrn-magnekristensen24446 ай бұрын
ai this gave me insperation want to try it in c, thanks bigbro
@eifclub9786 ай бұрын
bro already sound like gigachad
@osmanldevleti48586 ай бұрын
It would be nice if you make a Mongoose video series.
@chetranshlasod51576 ай бұрын
@BroCodez do data structures in panda pleasee love ur vids ..... 🙌
@jordankerr16 ай бұрын
Can you do ISpalindrome method/reverse string in c#?
@s.p_akash6 ай бұрын
Broo can you make a video about Regular Expressions in Python
@naveenshankar-jk2vd6 ай бұрын
Try to.make videos for node js bro it is a upcoming source library
@S.h.a.d.o.w.S.c.r.i.p.t.e.r6 ай бұрын
Bro Please Explain Django and Flask
@ranz10406 ай бұрын
Make a go language Playlist please
@jadotati76416 ай бұрын
Make an assembly course🙂!
@mdyusufansari88976 ай бұрын
can we add these project in our cv
@melkor11776 ай бұрын
we need a kotlin tutorial
@ideology83236 ай бұрын
My bro, help me understand the express node js module!
@iDebashish6 ай бұрын
Please Bro do a full course of Kotlin.
@Yuji_076 ай бұрын
like if u want more react tutorial
@ChickenNoodleSandwich6 ай бұрын
GAMBLEING YEAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
@3minutesbibletruth6 ай бұрын
My laptop spoilt so I was not able to follow up with the good content and build my carrier
@roelroel2k36 ай бұрын
i copied everything but theres a bug in line 49, 45, 8 I'm using python 3.9.6
@3minutesbibletruth6 ай бұрын
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.
@VAIBHAVRAGHAV-g6y6 ай бұрын
Relax buddy
@RealSyLol6 ай бұрын
pls type hinting 4 python
@3minutesbibletruth6 ай бұрын
Nothing seems to be working for me. The part of the world I find myself is very tough.
@moegreene36306 ай бұрын
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.
@KingXJulien6 ай бұрын
Kotlin please
@3minutesbibletruth6 ай бұрын
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
@manavmehta93956 ай бұрын
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.
@RayTheBos6 ай бұрын
Bro Code pls do C++ full course with Unreal Engine (making a game)