Python Forum
Displaying number of currency
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Displaying number of currency
#1
My assignment is to write a program using Python which accepts amount as integer from the user and displays total number of Notes (Currency) 100, 50, 20, 10, 5 and 1.

This is what I made in response:
print(“How much are you depositing today?”)
number=int(input(“How much are you depositing today?”))

hundreds = number // 100
number = number – 100 * tens
fifties = number // 50
number = number – 50 * fifties
tens = number // 10 
number = number – 10 * tens
fives = number // 5
number = number – 5 * fives 
ones = number // 1
number = number – 1 * ones 
When I use this on python 3.6.0 I get a syntax error, not sure what.
Please help.
Reply
#2
(Jan-16-2018, 05:01 PM)danellapotter Wrote: When I use this on python 3.6.0 I get a syntax error, not sure what.
What's the error? Please share the whole traceback.

If I had to guess, it's because you don't have quotes around the string you're printing/passing to input. You're using those pretend quote characters that Word likes to insert everywhere, instead of an actual quote character.
Reply
#3
on line#5 you have variable tens which is not yet defined. I guess you mean hundreds
That said, please always post full traceback in error tags, when you get one
Reply
#4
aaa, I guess you copy/paste this from a book - double quotes and minus are not ascii chars
should be "
and
should be -

when you fix this, you will get the error I refer to in my previous post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Displaying list correspond to the column number danlopek14q 9 3,969 Aug-27-2021, 04:32 AM
Last Post: naughtyCat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020