-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpycodes100_16_Invoice Generator.py
More file actions
70 lines (55 loc) · 2.11 KB
/
pycodes100_16_Invoice Generator.py
File metadata and controls
70 lines (55 loc) · 2.11 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#https://newdigitals.org/2024/02/24/100-basic-python-codes/#invoice-generator
#An invoice is a bill that serves as proof of a transaction between a buyer and a seller. here, we need only basic print and formatting statements
# create a product and price for three items
product1_name, product1_price = 'Books', 50.95
product2_name, product2_price = 'Computer', 598.99
product3_name, product3_price = 'Monitor', 156.89
# create a company name and information
company_name = 'Thecleverprogrammer, inc.'
company_address = '144 Kalka ji.'
company_city = 'New Delhi'
# declare ending message
message = 'Thanks for shopping with us today!'
# create a top border
print('*' * 50)
# print company information first using format
print('\t\t{}'.format(company_name.title()))
print('\t\t{}'.format(company_address.title()))
print('\t\t{}'.format(company_city.title()))
# print a line between sections
print('=' * 50)
# print out header for section of items
print('\tProduct Name\tProduct Price')
# create a print statement for each item
print('\t{}\t\t${}'.format(product1_name.title(), product1_price))
print('\t{}\t${}'.format(product2_name.title(), product2_price))
print('\t{}\t\t${}'.format(product3_name.title(), product3_price))
# print a line between sections
print('=' * 50)
# print out header for section of total
print('\t\t\tTotal')
# calculate total price and print out
total = product1_price + product2_price + product3_price
print('\t\t\t${}'.format(total))
# print a line between sections
print('=' * 50)
# output thank you message
print('\n\t{}\n'.format(message))
# create a bottom border
print('*' * 50)
Output:
**************************************************
Thecleverprogrammer, Inc.
144 Kalka Ji.
New Delhi
==================================================
Product Name Product Price
Books $50.95
Computer $598.99
Monitor $156.89
==================================================
Total
$806.83
==================================================
Thanks for shopping with us today!
**************************************************