Answer: See below
Explanation:
<u>Description:</u> In this program, read-option from the user and based on that, perform the operation. And display the balance if the balance is negative.
<u>transactions.py</u>
balance = 1000
#read options from the user
option = input("Deposit or withdrawal: ")
amount = 0
#check if option is a withdrawal
if option == 'withdrawal':
amount = int(input("Enter an amount: "))
balance = balance - amount
#check option is deposit
elif option == 'deposit':
amount = int(input("Enter an amount: "))
balance = balance + amount
else:
print("Invalid transaction.")
#check balance is less than 0 (negative)
if balance < 0:
print("You cannot have a negative balance!")
else:
print("Final balance:",balance)