This is my first question ever so sorry if its a bit inefficient.
Im creating an ATM with Python and MySQL for a school project. it needs to have balance, deposit and withdraw options. balance and deposit are done (pretty easy) but for withdraw i need a function that says "you are overdrawn" if the balance column drops below 0
What i need help with is reading input from the 'balance' column and using it in a if statement
psuedocode idea:
cur.execute(*) #the SQL statement to reduce the balance column by x
set data to ('balance data') #read the SQL data and set as variable
if data is less than 0
send "you are overdrawn" to display
else
db.commit() #the python command to edit the table
endif
i hope that helps to convey what i want to happen any help would be appreciated. i would ask my professor but im pretty sure i would loose marks if i did. any suggestions on how to format questions properly would also be apreciated. once again thanks
Aucun commentaire:
Enregistrer un commentaire