-
Notifications
You must be signed in to change notification settings - Fork 1
/
lesson-08.py
executable file
·43 lines (33 loc) · 867 Bytes
/
lesson-08.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
# lesson-08.py - allow user to supply transaction amounts
#
# Learn:
# user input
# string conversion to integer
def showBalance():
global balance
print('Your balance is $%d.' % balance)
print()
def withdrawal(amount):
global balance
print('Withdraw $%d.' % amount)
balance -= amount
showBalance()
def deposit(amount):
global balance
print('Deposit $%d.' % amount)
balance += amount
showBalance()
def main():
print('Welcome to the bank.')
showBalance()
amount = int(input('Enter amount to withdraw: '))
withdrawal(amount)
amount = int(input('Enter amount to deposit: '))
deposit(amount)
amount = int(input('Enter amount to withdraw: '))
withdrawal(amount)
amount = int(input('Enter amount to deposit: '))
deposit(amount)
balance = 100
main()