Added Homework 04 - Strings
This commit is contained in:
parent
aad4e226c5
commit
be356ccb59
24 changed files with 315 additions and 0 deletions
22
homework/homework04/fstrings/fstrings07.py
Normal file
22
homework/homework04/fstrings/fstrings07.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
APPLES = .50
|
||||
BREAD = 1.50
|
||||
CHEESE = 2.25
|
||||
|
||||
numApples = 3
|
||||
numBread = 10
|
||||
numCheese = 6
|
||||
|
||||
prcApples = numApples * APPLES
|
||||
prcBread = numBread* BREAD
|
||||
prcCheese = numCheese * CHEESE
|
||||
strApples = 'Apples'
|
||||
strBread = 'Rye Bread'
|
||||
strCheese = 'Cheese'
|
||||
total = prcBread + prcCheese + prcApples
|
||||
|
||||
print(f'{"My Grocery List":^30s}')
|
||||
print(f'{"="*30}')
|
||||
print(f'{strApples:10s}{numApples:10d}\t${prcApples:>5.2f}')
|
||||
print(f'{strBread:10s}{numBread:10d}\t${prcBread:>5.2f}')
|
||||
print(f'{strCheese:10s}{numCheese:10d}\t${prcCheese:>5.2f}')
|
||||
print(f'{"Total:":>20s}\t${total:>5.2f}')
|
||||
Loading…
Add table
Add a link
Reference in a new issue