I am currently taking an AP Computer Science course, and I was doing fine until I came across this assignment. I do not know how to make an if statement for a boolean name specific. I was hoping that someone could help me so that I can just get that part done. I will also include a picture of the assignment so you can see what I mean.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
bal = 1000 input ( "Deposit or Withdrawal?: " ) if "withdrawal" : withdraw = int ( input ( "How much would you like to withdrawal?: " )) if withdraw > 1000 : print "You cannot have a negative balance!" elif withdraw < 0 : print "You cannot withdraw less than zero!" else : print bal - withdraw elif "deposit" : depo = int ( input ( "How much would you like to deposit?: " )) if depo < 0 : print "INVALID TRANSACTION: CANNOT DEPOSIT NEGATIVELY" else : print bal + depo else : print "INVALID CHOICE, CHOOSE EITHER WITHDRAWAL OR DEPOSIT IN ALL LOWERCASE" |