Format an Invoice

Introduction

This project is an exercise in formatting with f-strings.

The Tale

You are working for a "parts" company in their IT department. Your boss wants you to generate an invoice to be included in every box shipped to a customer.

Project #1

Format and print an invoice using f-strings. See the example found HERE .

Add at least 8 more products to the list (warehouse inventory) shown below1.

Randomly pick a minimum of 6 products from the list (warehouse inventory) for the invoice.

Print the invoice. (This will require a mono space font.)

Requirements/Design/Business-Rules

     1see the Inputs below.

Project #2

Create a program that allows the user to select the items to purchase. Generate the box invoices for the items to ship. (Perhaps a GUI?)

Project #3

a. save the minimum invoice information in a JSON file.
b. read the invoice information from a JSON file.
c. recreate the original invoice(s).

Inputs

customerid = '00054619'

invoiceid = '00001'

from = ['ABC Parts Company', 'Dept 001', '2121 Parts Rd', 'Parts, OH 91234' ]

to = ['Flying Machines', '120 Airport Ave', 'Billings, MT 78912' ]

Warehouse inventory # product id, description, unit-cost, quantity on hand items = [ [841, 'Flux Capacitor', 123.47, 3], [32, 'Glow stick', 0.99, 100], [47865,'Lightsaber', 105.00, 1], [1, 'Sonic Screwdriver', 99.99, 1] ] Add more products to this list

Question: what does this code do?

print('*'*30)

s = 'abc' l = len(s) # length w = 20 # width print(f'{" "*(w-l)}{s:>}')

Links

5 Useful F-String Tricks In Python (YouTube)