Python Forum
Help with multiple conditions on ATM program
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with multiple conditions on ATM program
#2
There are some basic things wrong here.
Calling another is not necessary and annoying:
balance = 0
withdraw = 0
option = 0
deposite = 0
import sys

print("Welcome to the JTM")
input("Press ENTER to continue")


def another():
    answer = input("Would you like to make another transaction y/n?: ").lower()
    if answer == 'y':
        active = True
    else:
        active = False
        sys.exit("Thank you for using JTM")


active = True

while active:
    print("1: Deposit")
    print("2: Withdraw")
    print("3: Balance")
    print("4: Quit")

    option = int(input("What would you like to do: "))

    if option == 1:
        deposite = int(input("How much would you like to deposit: "))
        print("Your deposited $" + str(deposite))
        balance = balance + deposite
    elif option == 2:
        print("Your total amount available for withdrawal is: $" + str(balance))
        while True:
            withdraw = int(input("Withdraw: $"))
            if withdraw > balance:
                print("Cannot withdraw more than available balance")
                continue
            balance = balance - withdraw
            break
    elif option == 3:
        print("balance: $" + str(balance))
    elif option == 4:
        sys.exit("Thanks")
Reply


Messages In This Thread
RE: Help with multiple conditions on ATM program - by Larz60+ - Dec-05-2017, 09:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Using SQLAlchemy, prevent SQLite3 table update by multiple program instances Calab 2 1,842 Aug-09-2023, 05:51 PM
Last Post: Calab
  How do you format Update statement with multiple conditions hammer 4 3,382 Dec-16-2021, 10:49 PM
Last Post: hammer
  Multiple conditions when indexing an array with or without np.where noob2305 1 3,597 Oct-25-2020, 02:06 PM
Last Post: jefsummers
  Multiple conditions, one is null moralear27 1 2,896 Sep-13-2020, 06:11 AM
Last Post: scidam
  multiple conditions Chandan 7 5,609 Jan-31-2020, 12:53 AM
Last Post: Chandan
  Having issues getting a multiple choice test program to work Py_JohnS 2 4,478 Sep-01-2018, 11:06 PM
Last Post: Py_JohnS
  Simplifying multiple "or" conditions in if statement. rhubarbpieguy 8 108,059 Jul-22-2017, 12:19 PM
Last Post: rhubarbpieguy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020