Skip to content

Commit de7c8e2

Browse files
committed
Added challange 4.3.10
1 parent cf91d2d commit de7c8e2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

CodeHS/4/3/10/Transaction.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
This program made by Joe
3+
"""
4+
total_balance = 1000
5+
min_bank = -0
6+
codehs_compiler_cant_underrstand_loops = 0
7+
8+
while codehs_compiler_cant_underrstand_loops < 20:
9+
user_input = input("deposit or withdrawal? ")
10+
if user_input == "deposit":
11+
print("Your current balance is $" + str(total_balance))
12+
total_balance = total_balance + int(input("How much to deposit? "))
13+
print("Your current balance is now $" + str(total_balance))
14+
elif user_input == "withdrawal":
15+
print("Your current balance is $" + str(total_balance))
16+
temp_balance = int(input("How much to withdrawal? "))
17+
if total_balance - temp_balance <= min_bank:
18+
print("You cannot have a negative balance!")
19+
else:
20+
total_balance = total_balance - temp_balance
21+
print("Your current balance is now $" + str(total_balance))
22+
else:
23+
print("Invalid transaction")
24+
codehs_compiler_cant_underrstand_loops = codehs_compiler_cant_underrstand_loops + 1

0 commit comments

Comments
 (0)