[Tutor] (no subject)
Avi Gross
avigross at verizon.net
Sun Nov 11 18:35:08 EST 2018
In replying to what "Stealth Fleet" asked, I have too many comments,
starting with a suggestion to put a SUBECT on the Subject: line.
Your first error was not converting the text input to an integer or floating
point number.
tokenAmount = input( "How many tokens would you like to buy or cash
in?: ")
Fix that and then see if other things fail.
BTW, you created functions which take no arguments and use a global variable
but then create local variables that would not persist in a real
application. If your assignment was just to print what would have been
calculated, that may suffice but that may be another area you think more
about.
-----Original Message-----
From: Tutor <tutor-bounces+avigross=verizon.net at python.org> On Behalf Of
Stealth Fleet
Sent: Sunday, November 11, 2018 6:00 PM
To: tutor at python.org
Subject: [Tutor] (no subject)
tokenAmount = input( "How many tokens would you like to buy or cash in?: ")
print (tokenAmount)
def buy ():
if tokenAmount <= 400:
buy = tokenAmount * .2099
print( " You would like to spend $"+(buy) + "on" + (tokenAmount) +
"tokens.")
elif tokenAmount > "400" <= "549":
buy = tokenAmount * .3999
print( " You would like to spend $"+(buy) + "on" + (tokenAmount) +
"tokens.")
elif tokenAmount >= "550" <= "749":
buy = tokenAmount * .4999
print( " You would like to spend $"+(buy) + "on" + (tokenAmount) +
"tokens.")
elif tokenAmount >= "750" <= "999":
buy = tokenAmount * .6299
print( " You would like to spend $"+(buy) + "on" + (tokenAmount) +
"tokens.")
else:
buy = tokenAmount * .7999
print( " You would like to spend $"+(buy) + "on" + (tokenAmount) +
"tokens.")
def cashIn ():
cashIn = tokenAmount * .05
print( "The amount of money you will receive is $"+ (cashIn))
tokenAmount works but the buy and cashIn are not being ran why? When I put
"print(buy, cashIn)" it gives me a long message that ends in an error any
and all help is greatly appreciated. Sent from Mail
<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
_______________________________________________
Tutor maillist - Tutor at python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list