ATM#

Open in Colab

atmbalance = 100000
balance = 1000000
userid = 789
pin = 0000

user = int(input('Enter your user id: '))
user_pin = int(input('Enter your pin: '))

#print("Type of variable user {}".format(type(user)))
if ((user == userid) and (pin == user_pin)):
  print("Hi {} Welcome to our famous bank!".format(userid))
  print("You have ${} balance".format(balance))

  withdraw = bool(input("Do you want to withdraw money? Enter True or Fals"))
  print(withdraw, type(withdraw))
  # Withdraw
  # if (withdraw):
  if (withdraw == True):
    money = int(input("How much money you would like to withdraw?"))
    # check for overdraft
    if (money > balance):
      print("You might be a millionaire, but you don't have that much in your balance")
    else: # the account has money
      if (money <= atmbalance): # checking if atm has money to give
        balance = balance - money
        atmbalance -= money  #atmbalance = atmbalance - money
        print("You have withdrawn ${} and your balance is ${}".format(money, balance))
      else: # the bank has no money
        print("Hehe Sorry we don't have any money! Thank you for being a loyal customer")
  # True or false for withdraw
  else:
    money = int(input("How much money you would like to deposit?"))
    if (money > 0):
      balance += money
      atmbalance += money
      print("Congrats! You now have ${} in your account".format(balance))
Enter your user id: 789
Enter your pin: 0000
Hi 789 Welcome to our famous bank!
You have $1000000 balance
Do you want to withdraw money? Enter 1 for yes 0 for no0
False <class 'bool'>
How much money you would like to deposit?250000
Congrats! You now have $1250000 in your account
789 == 789
True
bool(-1000)
True
bool('True')
True