Let's code a beginner Python BANKING PROGRAM 💰

preview_player
Показать описание
#python #pythonprogramming #pythontutorial

This is an exercise do help us learn about functions in Python. Code for this program is pinned in the comments section down below.
Рекомендации по теме
Комментарии
Автор

# Python Banking Program

def show_balance(balance):

print(f"Your balance is ${balance:.2f}")


def deposit():

amount = float(input("Enter an amount to be deposited: "))

if amount < 0:

print("That's not a valid amount")

return 0
else:
return amount

def withdraw(balance):

amount = float(input("Enter amount to be withdrawn: "))


if amount > balance:

print("Insufficient funds")

return 0
elif amount < 0:

print("Amount must be greater than 0")

return 0
else:
return amount

def main():
balance = 0
is_running = True

while is_running:

print(" Banking Program ")

print("1.Show Balance")
print("2.Deposit")
print("3.Withdraw")
print("4.Exit")

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("That is not a valid choice")



print("Thank you! Have a nice day!")


if ___name___ == '__main__':
main()

BroCodez
Автор

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

chandrasekarkrishnasamy
Автор

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

robertcabuto
Автор

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

gamkid
Автор

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!

cybericanthecoder
Автор

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

Black_Orb
Автор

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

Deondree
Автор

Great video and very well explained! Thank you!

paskuini
Автор

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

sravanthinandinig
Автор

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

whislevarshan
Автор

I'm glad Bro posted another great video !

someMF_XD
Автор

Man this in java would have been like 200 lines lmao

mawhadmd
Автор

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 ..

Автор

this project looks interesting already

MaxNewberg-rl
Автор

the best teacher for learning python is print"code with harry"❤❤

adnankhan-eimg
Автор

Finally I found the right channel for python ❤

sagheerahmed
Автор

Thanks man great beginner project, keep em coming.

paraglide
Автор

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

lordrobertclive-vcld
Автор

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.

GfoxSim
Автор

I needed this so badly! Thanks for sharing❤

peerlessindifference