Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #You could do return amount at the end of a function and when you call the function you could do something like balance = deposit() - ping
- def Withdraw(amount):
- num = input("Withdraw amount: ")
- num = float(num)
- if (num <= amount):
- amount = (amount - num)
- else:
- print ("\nInsufficent funds.")
- print ("\nTotal: $" + str(amount))
- return amount
- def Deposit(amount):
- num = input("Deposit amount: ")
- num = float(num)
- if (num <= amount):
- amount = (amount + num)
- print ("\nTotal: $" + str(amount))
- return amount
- new_username = input("Please set a username: ")
- new_password = input("Please set a password: ")
- print ("User saved")
- while True:
- print ("\nWelcome to PythonBank. Please enter your account credentials.")
- username = input("\nUsername: ")
- if username == new_username:
- password = input("Password: ")
- if password == new_password:
- print ("Succesfully logged in as " + new_username)
- while True:
- amount = 2000
- amount = float(amount)
- print ("")
- operation = input("What would you like to do? \n(Balance, Withdraw, Deposit, Checkings, Savings, Logout): ")
- operation = operation.lower()
- if operation == ("balance"):
- print ("\nTotal: $" + str(amount))
- if operation == ("withdraw"):
- amount = Withdraw(amount)
- if operation == ("deposit"):
- amount = Deposit(amount)
- if operation == ("Checkings"):
- print ("Todo")
- if operation == ("Savings"):
- print ("Todo")
- if operation == ("logout"):
- break
- else: print ("\nFailed to login. Please check your spelling and try again.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement