forked from likair/python-programming-course-assignments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssignment4_5.py
25 lines (17 loc) · 825 Bytes
/
Assignment4_5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'''
Created on May 17, 2015
A program which displays the following list so that name values have 15 places and are left aligned,
unit prices have 10 places and are center aligned and amount values have 5 places and are right aligned.
Name Unit Price Amount
Apple 1.98 150
Orange 0.99 250
Peach 1.99 180
Passion 3.45 235
@author: Likai
'''
lineFormat = "{:<15}{:^10}{:>5}"
print(lineFormat.format('Name', 'Unit Price', 'Amount'))
print(lineFormat.format('Apple', 1.98, 150))
print(lineFormat.format('Orange', 0.99, 250))
print(lineFormat.format('Apple', 1.99, 180))
print(lineFormat.format('Passion', 3.45, 235))