Python Forum
Calculate and print the total cost
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculate and print the total cost
#1
Please help, i'm stuck.


Write Python code to allow a user to enter the number of bus tickets required. The user is then asked to enter the price of a bus ticket. Calculate and print the total cost. Ask the user to enter the amount of money offered, calculate and print the change, in the format
Change from £nn.nn is £mm.nn
Reply
#2
is this homework?
Recommended Tutorials:
Reply
#3
no it’s a question i got given to push my python knowledge further from a friend who is helping my learn python, but i can’t seem to do it. and the friend who gave it to me hasn’t replied with some help so i thought i’d ask here.
Reply
#4
By just giving you the code the learning aspect would be pretty much gone so the total code is in the spoiler. I'll give you some hints now so you can give it a try yourself first.
Hints:
-You have to prompt the user for the number of tickets, the price and the amount of money they give you. Use input() to prompt the user.
-After prompting the number of tickets and the price you can just calculate the total price and prompt again for the money given. Then calculate again and print it.

If you have any questions or comments don't hesitate to message
W

ps. Don't give up! I started learning python like 1.5 weeks ago and however the start is hard you'll get the hang of it fast!

Reply
#5
Start with this
Quote:Write Python code to allow a user to enter the number of bus tickets required.
You can use a tutorial such as this one.
Reply
#6
thanks for your help
Reply
#7
hi i also have been given this question and i really need help could you tell me how you done it
Reply
#8
Share your code. The above discussion should be enough to help you get started.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  class - calculate total price of copies 3lnyn0 1 1,559 Dec-12-2021, 11:43 PM
Last Post: BashBedlam
  Total electric construction cost project SecondSandwich94 2 2,157 Jul-21-2021, 09:37 PM
Last Post: deanhystad
  Reproducing assignment with min cost flow in networkx mntfr 0 2,133 Jun-13-2019, 04:06 PM
Last Post: mntfr

Forum Jump:

User Panel Messages

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