Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Jan 29, 2021
Embed
What would you like to do?
# 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment