Can you please right align all numeric values and align on the decimal point please. SMALL_BEADS = 10.20 MEDIUM_BEADS = 8.52 LARGE_BEADS = 7.98 small = int(input('Enter the number of boxes of small beads : ')) medium = int(input('Enter the number of boxes of medium beads: ')) large = int(input('Enter the number of boxes of large beads : ')) smallTotal = small * SMALL_BEADS mediumTotal = medium * MEDIUM_BEADS largeTotal = large * LARGE_BEADS total = smallTotal + mediumTotal + largeTotal print("SIZE\tQTY\tCOST PER BOX\tTOTALS\n") print(f"Small\t {small}\t{SMALL_BEADS:.2f}\t\t {smallTotal:.2f}") print(f"Medium\t {medium}\t {MEDIUM_BEADS:.2f}\t\t {mediumTotal:.2f}") print(f"Large\t {large}\t {LARGE_BEADS:.2f}\t\t {largeTotal:.2f}") print(f"TOTAL\t\t\t\t {total:.2f}")
Can you please right align all numeric values and align on the decimal point please.
SMALL_BEADS = 10.20
MEDIUM_BEADS = 8.52
LARGE_BEADS = 7.98
small = int(input('Enter the number of boxes of small beads : '))
medium = int(input('Enter the number of boxes of medium beads: '))
large = int(input('Enter the number of boxes of large beads : '))
smallTotal = small * SMALL_BEADS
mediumTotal = medium * MEDIUM_BEADS
largeTotal = large * LARGE_BEADS
total = smallTotal + mediumTotal + largeTotal
print("SIZE\tQTY\tCOST PER BOX\tTOTALS\n")
print(f"Small\t {small}\t{SMALL_BEADS:.2f}\t\t {smallTotal:.2f}")
print(f"Medium\t {medium}\t {MEDIUM_BEADS:.2f}\t\t {mediumTotal:.2f}")
print(f"Large\t {large}\t {LARGE_BEADS:.2f}\t\t {largeTotal:.2f}")
print(f"TOTAL\t\t\t\t {total:.2f}")
Solution in Python Language:
Step by step
Solved in 3 steps with 2 images