Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Python3 - product lists
#python 3.5.2 products_tbl={ 'R1':{"ProductID":1, "ProductName":"Chai", "SupplierID":1, "CategoryID":1, "QuantityPerUnit":"10 boxes x 20 bags", "UnitPrice":18.0000, "UnitsInStock":39, "UnitsOnOrder":0, "ReorderLevel":10, "Discontinued":False }, 'R2':{"ProductID":2, "ProductName":"Chang", "SupplierID":1, "CategoryID":1, "QuantityPerUnit":"24 - 12 oz bottles", "UnitPrice":19.0000, "UnitsInStock":17, "UnitsOnOrder":40, "ReorderLevel":25, "Discontinued":False } } # It's better to use tuple over lists if you don't want to perform any update/delete/add operations # Tuples are faster and space efficient in comparison to lists column_names = ("ProductName", "ProductID", "SupplierID", "CategoryID", "QuantityPerUnit", "UnitsInStock", "UnitsOnOrder", "ReorderLevel", "UnitPrice", "Discontinued") print("Product Name\tProduct Id\tSupplier Id\tCategory Id\tQty Per Unit\tUnits In Stock\tUnits On Order\tRecord Level\tUnit Price\tDiscontinued") print("---------------------------------------------------------------------------------------------------------------") for key in products_tbl: for column_name in column_names: print(products_tbl[key][column_name], end="\t"); print()
run
|
edit
|
history
|
help
0
Lesson 6 part b2
codigo1
RANDOM NUMBER
Find common characters between two strings
yield from example
Convert String to Lower Case
Sri rama
JV
Set
Name