Let's code a beginner Python BANKING PROGRAM 💰

Поділитися
Вставка
  • Опубліковано 29 січ 2025

КОМЕНТАРІ • 182

  • @BroCodez
    @BroCodez  8 місяців тому +191

    # Python Banking Program
    def show_balance(balance):
    print("*********************")
    print(f"Your balance is ${balance:.2f}")
    print("*********************")
    def deposit():
    print("*********************")
    amount = float(input("Enter an amount to be deposited: "))
    print("*********************")
    if amount < 0:
    print("*********************")
    print("That's not a valid amount")
    print("*********************")
    return 0
    else:
    return amount
    def withdraw(balance):
    print("*********************")
    amount = float(input("Enter amount to be withdrawn: "))
    print("*********************")
    if amount > balance:
    print("*********************")
    print("Insufficient funds")
    print("*********************")
    return 0
    elif amount < 0:
    print("*********************")
    print("Amount must be greater than 0")
    print("*********************")
    return 0
    else:
    return amount
    def main():
    balance = 0
    is_running = True
    while is_running:
    print("*********************")
    print(" Banking Program ")
    print("*********************")
    print("1.Show Balance")
    print("2.Deposit")
    print("3.Withdraw")
    print("4.Exit")
    print("*********************")
    choice = input("Enter your choice (1-4): ")
    if choice == '1':
    show_balance(balance)
    elif choice == '2':
    balance += deposit()
    elif choice == '3':
    balance -= withdraw(balance)
    elif choice == '4':
    is_running = False
    else:
    print("*********************")
    print("That is not a valid choice")
    print("*********************")
    print("*********************")
    print("Thank you! Have a nice day!")
    print("*********************")
    if ___name___ == '__main__':
    main()

    • @mohameddeeq-l2s
      @mohameddeeq-l2s 8 місяців тому +1

      how about stopwatch program

    • @idiotzRus
      @idiotzRus 5 місяців тому

      meep

    • @lilou_cloud
      @lilou_cloud 5 місяців тому

      this is amazing and very organised! 👏

    • @cocoatea57
      @cocoatea57 4 місяці тому

      How do we save it in a database? Bro

    • @IISTAB
      @IISTAB 3 місяці тому +1

      ​@@cocoatea57 json file maybe

  • @chandrasekarkrishnasamy7197
    @chandrasekarkrishnasamy7197 7 місяців тому +151

    Hi, I am 57 years old. I run my first successful code because of you ❤

    • @mohammadsami5579
      @mohammadsami5579 7 місяців тому +2

      jabarjast
      👍

    • @mohammadsami5579
      @mohammadsami5579 7 місяців тому +6

      r u from India ?

    • @Hnxzxvr
      @Hnxzxvr 3 місяці тому +3

      Good job

    • @ErixMlk
      @ErixMlk 2 місяці тому +1

      Ur too old at this point

    • @Lugey011
      @Lugey011 2 місяці тому

      @@ErixMlk Wow. Oof. No one is old to do anything. Grow up, and please get plastic surgery, that face is 🫡🫡🫡. Be happy for him.

  • @whislevarshan3752
    @whislevarshan3752 7 місяців тому +17

    00:01 Creating a simple banking program using Python.
    01:31 Creating a bank program and taking user input for banking options.
    03:36 Handle invalid input with else statements
    05:17 Creating functions to handle balance display and deposit.
    07:17 Updating the deposit function to handle negative deposits and returning a valid amount
    09:15 Validate user input and handle withdrawal process
    11:15 Enclosing the main portion of code within a function for better readability and maintainability.
    12:47 Pass balance to withdraw and show functions

  • @robertcabuto3284
    @robertcabuto3284 8 місяців тому +72

    I wish my bank's website was like that - just the basics - without so many ads.

  • @gam3kid
    @gam3kid 3 місяці тому +6

    You explained this better than the community college programming teacher. And this was free.

  • @cybericanthecoder
    @cybericanthecoder 8 місяців тому +19

    Wow! Amazing little course. Loved it! Please make more like this, I'm a beginner, so I would appreciate it. Your content and channel are awesome! Looking forward to a another mini course. You Rock!

  • @Deondree
    @Deondree 8 місяців тому +34

    Bro you need to give a tutorial on api’s I need help with it and there’s no other guy that can explain stuff like you do

  • @3549119
    @3549119 8 місяців тому +3

    too much value in this channel bro...
    i 'm from brazil, i am turn into a very big fa and new student member.
    thanks for all this knowledge for FREE! Have no words ..

  • @lilou_cloud
    @lilou_cloud 5 місяців тому +4

    you explained this really well by breaking things down and speaking slowly so thank you 😊

  • @a-a-r-s-h-i-e
    @a-a-r-s-h-i-e 8 місяців тому +11

    I'm glad Bro posted another great video !

  • @Kov873
    @Kov873 Місяць тому

    It's easier to understand and accessible to all. Fantastic! Many thanks

  • @paraglide01
    @paraglide01 8 місяців тому +4

    Thanks man great beginner project, keep em coming.

  • @sagheerahmed5601
    @sagheerahmed5601 2 місяці тому +1

    Finally I found the right channel for python ❤

  • @MaxNewberg-r4l
    @MaxNewberg-r4l 6 місяців тому +4

    this project looks interesting already

  • @peerlessindifference
    @peerlessindifference 4 місяці тому +1

    I needed this so badly! Thanks for sharing❤

  • @sravanthinandinig6917
    @sravanthinandinig6917 3 місяці тому +2

    That's great sir, please make other projects also like this

  • @kapibara2440
    @kapibara2440 6 місяців тому +2

    You are a brilliant teacher 😊

  • @GfoxSim
    @GfoxSim 7 місяців тому +1

    WOW, great Python project. Could you please cover Unit Testing in one of the videos, perhaps for this specific project. Unit Testing makes it easier to test projects and speeds up the development process. If you've already covered it, please link me to the video.

  • @mawhadmd
    @mawhadmd 8 місяців тому +93

    Man this in java would have been like 200 lines lmao

    • @aguyontheinternet1
      @aguyontheinternet1 8 місяців тому

      86 Lines total.
      (compared to 71 in python)
      55 Lines if you take a minute to "optimize it for space"
      (remove whitespaces and some repeated print statements)
      Could 100% be brought down even further by more optimization
      ~~~~~~~~~~~~~~~~~~~
      import java.util.Scanner;
      class Bank {

      static Scanner scan = new Scanner(System.in);

      public static void showBalance(float balance) {
      System.out.println("*********************");
      System.out.println("Your balance is $" + String.format("%.2f", balance));
      System.out.println("*********************");
      }

      public static float deposit() {
      System.out.println("*********************");
      System.out.println("Enter an amount to be deposited: ");
      float amount = Float.parseFloat(scan.nextLine());
      System.out.println("*********************");

      if (amount < 0) {
      System.out.println("*********************");
      System.out.println("That's not a valid amount");
      System.out.println("*********************");
      return 0;
      }
      return amount;
      }
      public static float withdraw(float balance) {
      System.out.println("*********************");
      System.out.println("Enter an amount to be withdrawn: ");
      float amount = Float.parseFloat(scan.nextLine());
      System.out.println("*********************");

      if (amount > balance) {
      System.out.println("*********************");
      System.out.println("Insufficient funds");
      System.out.println("*********************");
      return 0;
      }
      else if (amount < 0) {
      System.out.println("*********************");
      System.out.println("Amount must be greater than 0");
      System.out.println("*********************");
      return 0;
      }
      return amount;
      }

      public static void main(String[] args) {
      float balance = 0;
      boolean running = true;

      while (running) {
      System.out.println("*********************");
      System.out.println(" Banking Program ");
      System.out.println("*********************");
      System.out.println("1. Show Balance");
      System.out.println("2. Deposit");
      System.out.println("3. Withdraw");
      System.out.println("4. Exit");
      System.out.println("Enter your choice (1-4): ");
      String choice = scan.nextLine();

      if (choice.equals("1")) {
      Bank.showBalance(balance);
      }
      else if (choice.equals("2")) {
      balance += Bank.deposit();
      }
      else if (choice.equals("3")) {
      balance -= Bank.withdraw(balance);
      }
      else if (choice.equals("4")) {
      running = false;
      }
      else {
      System.out.println("*********************");
      System.out.println("That is not a valid choice");
      System.out.println("*********************");
      }
      }
      System.out.println("*********************");
      System.out.println("Thank you! Have a nice day!");
      System.out.println("*********************");
      }
      }

    • @cleevensluxama1242
      @cleevensluxama1242 8 місяців тому +14

      in Java it will run faster lmao

    • @jjgg2627
      @jjgg2627 7 місяців тому

      @@cleevensluxama1242By a few secs smh.

    • @namelessbrown
      @namelessbrown 7 місяців тому

      ​@@cleevensluxama1242For this program, it doesn't matter how fast. Humans wouldn't even recognize the difference.

    • @youtubeacc666
      @youtubeacc666 7 місяців тому

      ​@@cleevensluxama1242with faster and stupid errors

  • @Aseretho
    @Aseretho 2 місяці тому

    Bro needless to say that this rocks. Thank you for everything you do Big BroCode.

  • @avtandil5433
    @avtandil5433 8 місяців тому +2

    Thank you for your job Bro!

  • @rayyanzaidi3323
    @rayyanzaidi3323 Місяць тому

    Awesome video. Love your content

  • @patitape1000
    @patitape1000 23 дні тому

    amazoig teacher. thanks

  • @paskuini
    @paskuini 2 місяці тому

    Great video and very well explained! Thank you!

  • @mohamedcoufi9873
    @mohamedcoufi9873 7 місяців тому +1

    Simple n easy thank you

  • @jofawole
    @jofawole 2 місяці тому

    this is a really dope tutorial.

  • @lukchem
    @lukchem 7 місяців тому +3

    I personally would add an try except around the inputs so the program doesn’t crash when the user types a String instead of a number in the input.

    • @promiseezeala2844
      @promiseezeala2844 5 місяців тому

      There already an else statement , you don’t need try and accept, and enter a negative number it will still run when it’s not supposed to

    • @supersoniqamanyi3075
      @supersoniqamanyi3075 4 місяці тому

      @@promiseezeala2844 That may not handle a KeyError, ValueError exceptions though

  • @Franck-kb7np
    @Franck-kb7np 7 місяців тому +2

    Vraiment un Super Bro👍

  • @gospelmoto2833
    @gospelmoto2833 5 місяців тому

    You immediately got a new sub here...worth it. Thanks!

  • @being5033
    @being5033 7 місяців тому +1

    thanks. appreciate a lot!

  • @francismannion7075
    @francismannion7075 7 місяців тому

    Thank you for a very interesting lesson.

  • @DANNYEL20122
    @DANNYEL20122 7 місяців тому +1

    I love your channel

  • @bhargavram4027
    @bhargavram4027 8 місяців тому

    welcome back chad! Missing you sooo much

  • @DeejayRobert
    @DeejayRobert 8 місяців тому +1

    Bro did the thing.

  • @jordan5652
    @jordan5652 8 місяців тому +3

    can you go over a more modern gui for python please when you get time.

  • @lindadelalifiasam5878
    @lindadelalifiasam5878 6 місяців тому

    😊😊😊love this lesson

  • @insanoglu6637
    @insanoglu6637 Місяць тому

    a great video

  • @DigItSalam
    @DigItSalam 5 місяців тому +1

    Great teacher.. you make coding sooooo simple❤.... Do you have tutorial on kivy?

  • @leonaise7546
    @leonaise7546 7 місяців тому

    Can you do a lesson on modules & packages?

  • @unexplainablefish52
    @unexplainablefish52 7 місяців тому

    That negative money 420.69 got me rollin hahaha

  • @kedarppopuri2776
    @kedarppopuri2776 8 місяців тому +2

    Bro love you 💖.

  • @aaa-d6i
    @aaa-d6i 4 місяці тому

    You could have made a data saving and automatic loading on end and start of the probram / exiting and starting its very easy to make

  • @pramodhkumar8771
    @pramodhkumar8771 8 місяців тому +1

    Thanks bro. Can you start tutorial on Golang .

  • @attohval
    @attohval 7 місяців тому

    Thank you so much.
    Please can you do a video for GUI on Python?

  • @gunjanmali3766
    @gunjanmali3766 6 місяців тому +1

    thank you sir

  • @technicalswag3925
    @technicalswag3925 7 місяців тому

    Sir please continue and complete the react course

  • @brunomartins824
    @brunomartins824 3 місяці тому

    great, now let's code the xfs layer 👏

  • @PedroRodriguez-dl5yt
    @PedroRodriguez-dl5yt 6 місяців тому

    Hey, how good to see ya

  • @adventureDad1976
    @adventureDad1976 7 місяців тому +2

    Great job!!

  • @KenStackTechnologies
    @KenStackTechnologies 8 місяців тому +1

    Its working. Thank u

    • @Nishanth_S
      @Nishanth_S 7 місяців тому

      what 😂, who are you 😂😂 🃏
      Seems like you are here for your intership project or final year project. Just learn the concept bro. don't copy the code 🃏

    • @aronix-o7
      @aronix-o7 7 місяців тому

      hey the majority of python developers. you speak for the majority of programmers? wow he should have known!​@@Nishanth_S

  • @lordrobertclive-vc5ld
    @lordrobertclive-vc5ld 5 місяців тому

    i did the same practice in chat gpt... !!! But i did that only by using while loop
    balance = 1000
    While True:
    print('ATM MENU')
    print('1. check the balance')
    print('2.Deposite Money')
    print('3.Withdraw Money')
    print('4.exit')
    Choose = input('Choose any option from 1-4')
    if Choose == 1:
    print(f'your current bank balance is:{balance}')
    elif Choose ==2:
    add_amount = float(input('enter the amount you want to add'))
    balance += add_amount
    print(f'Now your current bank balance is: {balance}')
    elif choose ==3:
    withdraw_amount = float(input('enter the amount of money you want to withdraw: '))
    if withdraw_amount>balance:
    print("you don't have so much balance! ')
    else:
    balance -=amount
    print(f' your new balance is : {balance}')
    elif choose == 4
    print('exiting the programme')
    break

    • @aliftawfiquealif
      @aliftawfiquealif 2 місяці тому

      bro this code is full of bug I've corrected all the bug here is the refined
      balance = 0
      X = True
      while X:
      print('ATM MENU')
      print('1. check the balance')
      print('2.Deposite Money')
      print('3.Withdraw Money')
      print('4.exit')
      Choose = int(input('Choose any option from 1-4'))
      if Choose == 1:
      print(f'your current bank balance is:{balance}')
      elif Choose == 2:
      add_amount = float(input('enter the amount you want to add'))
      balance += add_amount
      print(f'Now your current bank balance is: {balance}')
      elif Choose == 3:
      withdraw_amount = float(input('enter the amount of money you want to withdraw: '))
      if withdraw_amount>balance:
      print("you don't have so much balance! ")
      else:
      balance -= amount
      print(f' your new balance is : {balance}')
      elif Choose == 4:
      print('exiting the programme')
      break

  • @Om-jo8eu
    @Om-jo8eu 8 місяців тому +1

    Thanks Bro!

  • @nialld2638
    @nialld2638 7 місяців тому

    Your videos are brilliant, they have been a great help. How would a person get this up onto their website as in how would yiu deploy it for an end user?

  • @SurafelTezera-d7o
    @SurafelTezera-d7o 8 місяців тому

    Hey bro!!! can you post a video on ML and AI

  • @tentimesful
    @tentimesful 7 місяців тому

    lol this is first year of programming did in in java without no knowledge in programmihng. but my teacher told me to use more methods or he wont help me if it didnt works as my program so complicated... but succeeded though for the class lol... but eventually i learned if you methodize everything then you can edit add or fix very fast.... believe me you dont want to read and update a code that is very big without methods with meaning... visual studio made it cool though you can select a code and say methodize and it selects the variables needed for that method and methodize it with the code you selected, very handy

  • @TorabekRaufov-p8x
    @TorabekRaufov-p8x 4 місяці тому

    bro is the best

  • @MhlengiMadlala-w9n
    @MhlengiMadlala-w9n 7 місяців тому +1

    Wow

  • @amitkumarverma369
    @amitkumarverma369 8 місяців тому

    Bro can do some tutorial on financial modelling with python

  • @maathmatics
    @maathmatics 7 місяців тому

    Great

  • @notlogic.the.second
    @notlogic.the.second Місяць тому

    can you do a simple crypto network? would be cool

  • @Norro_o
    @Norro_o 7 місяців тому

    pls make a video about explaining grid in css🙏🙏

  • @marcinzale
    @marcinzale 8 місяців тому +2

    Please record such a video but with datya saving function to e.g. SQLlite, Firebase or at least a file. Now when you close the program, the data is lost. It will be more useful and close to real life. Anyway, thanks.

  • @sarimbinwaseem
    @sarimbinwaseem 6 місяців тому +6

    Good video for beginners..
    Just giving some suggestions if someone is interested.
    1. Use match case for choices. It looks pretty and more readable.
    2. After using return in all if and elif statements, the last else is not needed. just directly return without an else.
    3. Use pylint to learn more.
    Not targeting Bro Code but getting the tips out there for anyone.

  • @MegadomeBuildersSdnBhd
    @MegadomeBuildersSdnBhd 3 місяці тому

    hi, tqsm for the sharing. I have a question, how do u do pytest on ths codes?

  • @Fujihanabi-r1b
    @Fujihanabi-r1b 8 місяців тому +1

    Hey bro any thoughts about making videos on backend development soon?

  • @revanthreddy790
    @revanthreddy790 8 місяців тому

    hey can you follow with a video adding more python functionality such as using some bank api to send notifications of bank balance (like emails) everyday so we are aware on a daily basis of what our balance is and how much we spent in the day?

  • @DivyanshuJain-nw3ts
    @DivyanshuJain-nw3ts 8 місяців тому

    Plz make a Django Full course🙏

  • @LeeAudreyMthembu
    @LeeAudreyMthembu 6 місяців тому

    May you please give us an API Tutorial

    • @SayfulloVohidov
      @SayfulloVohidov Місяць тому

      How u wrote this striker thx before 🤝

  • @kedarppopuri2776
    @kedarppopuri2776 8 місяців тому +1

    AND Please Conside doing a django Tutorial man.

  • @quangquyennguyen9390
    @quangquyennguyen9390 8 місяців тому

    You have a plan for Go or typescript, Bro?

  • @CharimelGarciasSantanas
    @CharimelGarciasSantanas 4 місяці тому

    Lo quisiera en Español este video ❤

  • @afin4684
    @afin4684 5 місяців тому

    That really nice! Ty!

  • @VishwanathK-mv6gj
    @VishwanathK-mv6gj 8 місяців тому

    Hi bro code , can you teach about database in python

  • @cj_kreates
    @cj_kreates 22 дні тому

    Day2 of learning python in 2026 and this video came my way. Like this video I'll be back

  • @Sowmiya-s9s
    @Sowmiya-s9s 24 дні тому +1

    So it default to understand sir

  • @astra8538
    @astra8538 7 місяців тому

    Would have been useful for the computer science project I had 7 months ago 😂

  • @MEK
    @MEK 3 місяці тому

    I thought your real bank website gives u api to do all these 😮

  • @LokeshPandeya
    @LokeshPandeya 5 місяців тому

    python api tutorail needed

  • @sonatapiece
    @sonatapiece 5 місяців тому

    What IDE are you using?

  • @Bacon_editsz
    @Bacon_editsz 8 місяців тому

    Is it possible you nest multiple functions into one function like less i made a function called bank function could put the these functions under one function

  • @ProfShibe
    @ProfShibe 8 місяців тому

    yippeeeee

  • @9snajper
    @9snajper 9 днів тому

    how do i code, that it doesnt reprint all that after i for example used the deposit
    print("*********************")
    print(" Banking Program ")
    print("*********************")
    print("1.Show Balance")
    print("2.Deposit")
    print("3.Withdraw")
    print("4.Exit")
    print("*********************")
    choice = input("Enter your choice (1-4): ")

  • @qasershah2000
    @qasershah2000 11 днів тому

    Which IDE you are using for python?

  • @Rachels__sweets_
    @Rachels__sweets_ 2 місяці тому

    What website can i use to program?

  • @deepmaru2002
    @deepmaru2002 5 місяців тому

    How to change color of run terminal text ??

  • @Kalnex1
    @Kalnex1 23 години тому

    One problem that i found and don't know how to solve is that u can deposit and withdrow less then 1 cent

  • @mr.blebberson4439
    @mr.blebberson4439 7 місяців тому

    it keeps saying that the variable "Balance" is undefined...1
    edit: and the else is also having problems. on line 16

  • @mohamedshehata4081
    @mohamedshehata4081 5 місяців тому

    #fix this code, such yhat numper = 12
    sprite.set_variable('number',0)
    for count in range("10"):
    if sprite.get_variable('number') < 11:
    v = sprite.get_variaple('number')
    sprite.set_variable('numper',v+1)
    else:
    sprite.stop_all(

  • @dylanmercergo7853
    @dylanmercergo7853 4 місяці тому

    Hello! So uh, in the first part where the while is placed, I did as you did but when run, it just keeps looping without giving options, like it just goes infinity. Help?

    • @unitnuity
      @unitnuity 4 місяці тому

      Is your True capitalized?

  • @SabonaMarara
    @SabonaMarara 8 місяців тому

    thanks bro code . how to connect mongodb ?

  • @TheSkarabeush
    @TheSkarabeush 7 місяців тому

    Which banking app or cash machine will let you withdraw negative amount???

  • @NewmanEbubechukwu
    @NewmanEbubechukwu 3 місяці тому

    Let's say this program works, how can i send money from my other bank account to this bank?

  • @ideology8323
    @ideology8323 8 місяців тому

    Bro I don't know nodeJs, pls help me

  • @markk.618
    @markk.618 24 дні тому

    done with mine

  • @lone_lyrcz
    @lone_lyrcz Місяць тому

    Which program?

  • @favasmhd
    @favasmhd 5 місяців тому

    bro which app is used

  • @Last_hope_gamer
    @Last_hope_gamer 3 місяці тому

    My while" is_running " keep printing an infinite amount of loops 😢 need help

  • @RealSyLol
    @RealSyLol 8 місяців тому

    pls type hinting 4 python

  • @Last_hope_gamer
    @Last_hope_gamer 3 місяці тому

    I'm using VS STUDIO CODE but I keep getting error at the withdrawal function.
    Can you help me please 🙏🙏

  • @KaramzadSh
    @KaramzadSh 8 місяців тому

    hi bro please of you see my comment answer me : did you know how can i write a leveling ? like RPG leveling for ranking the users? such as to day trend in telegram crypto bots based on tap mining? please if any one know ho to make a leveling system answer me