target_letter = "r" for animal in ["horse", "cat", "racoon", "duck"]: if target_letter in animal: print(animal + " contains the letter " + target_letter) else: print("sorry, no " + target_letter + " in " + animal) def lots_of(x): return 3 * x stuff = "milk " print(type(stuff)) print(lots_of(stuff)) stuff = 3 print(type(stuff)) print(lots_of(stuff)) import datetime print(lots_of(datetime.datetime.now())) target_letter = "r" for animal in ["horse", "cat", "racoon", "duck"]: if target_letter in animal: print(animal + " contains the letter " + target_letter) else: print("sorry, no " + target_letter + " in " + animal) target_letter = "r" for animal in ["horse", "cat", "racoon", "duck"]: if target_letter in animal: print(animal + " contains the letter " + target_letter) else: print("sorry, no " + target_letter + " in " + animal) animal = "moose" animal.upper() class Animal(object): def eat(self, food): return "What yummy " + food + "!" fido = Animal() fido.eat('dog food') class Cat(Animal): def purr(self): return 'rrrrrrrrrrrrrrrr' agamemnon = Cat() agamemnon.eat('hotdish') agamemnon.purr() fido.purr() help("x".upper) dir("x") hotdish_ingredients = ["noodles", "tuna", "mayo", "celery"] shopping_list = ["apple", "bread", hotdish_ingredients, "spinach"] for buy_me in shopping_list: print(buy_me) german = {"cat": "Katze", dog: "Hund"} german["cat"] name = "American of Personal Computer User Groups" initials = [letter for letter in name if letter.isupper()] print(initials) abbrev = "".join(initials) print(abbrev) import requests response = requests.get('http://dma1.org') response.status_code response.content[:100] import re re.search(">(APCUG.*?)<", str(response.content)).group(1)