Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spacing/Formatting
#1
Hi!

I'm having some problems with spacing/formatting. I'm trying to get the pizza, state_tax, and pizza + state_tax outputs to start at directly under the 'H' in 'Here are the results:' and then have the numbers extend to the left. I tried <, >, and ^, but depending upon how big the pizza float is, the spacing doesn't match up. Any idea what I'm doing wrong?

Any help would be appreciated.
def main():
    name = 'Peter Tork'
    print('Welcome to Your Favorite Survey Program')
    print()
    print("Today we surveyed "+name+"."  "  Here are the results:")
    pizza = float(input ('11. If you order pizza, about how much would you pay before taxes? '))
    tax = float(0.065)
    state_tax = pizza * tax
    print(f'10. Pizza Cost: ${pizza:^34,.2f}')
    print(f'State Tax: ${state_tax:^34,.2f}')
    print(f'Pizza Total: ${pizza + state_tax:,.2f}')
main()
Reply


Messages In This Thread
Spacing/Formatting - by Hendrixson29 - Aug-29-2020, 05:30 AM
RE: Spacing/Formatting - by Gribouillis - Aug-29-2020, 08:38 AM
RE: Spacing/Formatting - by bowlofred - Aug-31-2020, 07:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pyplot line color and spacing/padding metalray 0 2,767 May-26-2017, 08:39 AM
Last Post: metalray

Forum Jump:

User Panel Messages

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