Nov-17-2018, 02:19 PM
(This post was last modified: Nov-17-2018, 02:20 PM by Jonininireland.)
using format
such as
pizzaTotal = 5
formatPizzaTotal = '{:>75}'.format(pizzaTotal)
i know moves the print 75 spaces to the right
but if i have
myString = "I have"
pizzaTotal = 10
totalPrice = pizzaTotal * 10.00
how can i print
I have [spaces] 10 pizzas [spaces] €total:100.00
also can all of this be done with one format line, or does each one have to be done seperate
also how can i get the $ in my format if i print it first it goes $ 5 ie it doesnt move with the format
and how can i get all decimals lined up from the right ie zeroes on the right
-----10.00
----100.00
---1000.00
i know i can just space them but if the values change they will be out of line
thanks
such as
pizzaTotal = 5
formatPizzaTotal = '{:>75}'.format(pizzaTotal)
i know moves the print 75 spaces to the right
but if i have
myString = "I have"
pizzaTotal = 10
totalPrice = pizzaTotal * 10.00
how can i print
I have [spaces] 10 pizzas [spaces] €total:100.00
also can all of this be done with one format line, or does each one have to be done seperate
also how can i get the $ in my format if i print it first it goes $ 5 ie it doesnt move with the format
and how can i get all decimals lined up from the right ie zeroes on the right
-----10.00
----100.00
---1000.00
i know i can just space them but if the values change they will be out of line
thanks