Skip to content

Instantly share code, notes, and snippets.

favorite_books = ["Midwives", "The Grapes of Wrath", "The Art of Racing in the Rain", "My Sister's Keeper", "Orphan Number Eight"]
family_tree = [{"father" : "Dave", "mother" : "Brenda", "children" : {"child_1" : "Pamela", "child_2" : "Greg", "child_3" : "Laura"}},
{"father" : "Henry", "mother" : "Gretta", "children" : {"child_1" : "Stephen", "child_2" : "David", "child_3" : "Mary Ann"}}]
# Zero tabs in Python. Indent the equivalent of FOUR spaces.
for book in favorite_books:
print("I love " + book + "!")
def calculate_tax(items):
tax_total = 0
for item in items:
print(item)
tax = item * .07
print(round(tax, 2))
tax_total += tax
milk = {'weight' : 7.8,'name': 'Milk', 'price': 2.99, 'taxable': False, 'upc': '0001'}
apples = {'weight' : 3.1, 'name': 'Apples', 'price': 3.99, 'taxable': False, 'upc': '0002'}
bread = {'weight' : 1.25, 'name': 'Bread', 'price': .99, 'taxable': False, 'upc': '0003'}
beer = {'weight' : 4.9, 'name': 'Beer', 'price': 7.99, 'taxable': True, 'upc': '0004'}
chips = {'weight' : 0.96, 'name': 'Chips', 'price': 1.50, 'taxable': False, 'upc': '0005'}
wine = {'weight' : 3.18, 'name': 'Red Wine', 'price': 9.99, 'taxable': True, 'upc': '0006'}
oreos = {'weight' : 1.08, 'name': 'Double Stuf Oreos', 'price': 2.50, 'taxable': False, 'upc': '0007'}
sushi = {'weight' : 1.65, 'name': 'Veggie Sushi', 'price': 5.99, 'taxable': False, 'upc': '0008'}
sprite = {'weight' : 2.82, 'name': 'Sprite', 'price': 3.99, 'taxable': True, 'upc': '0009'}
candy = {'weight' : 0.43, 'name': 'Sour Patch Kids', 'price': 1.99, 'taxable': True, 'upc': '0010'}