This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bottles_of_beer(bob): | |
| if bob < 1: | |
| print("""No more bottles of beer on the wall. No more | |
| bottles of beer.""") | |
| return | |
| tmp = bob | |
| bob -= 1 | |
| print("""{} bottles of beer on the wall. {} bottles | |
| of beer. Take one down, pass it around, | |
| {} bottles of beer on the wall.""".format(tmp, tmp, bob)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if bob < 1: | |
| print("""No more bottles of beer on the wall. No more | |
| bottles of beer.""") | |
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person: | |
| def __init__(self, height, weight): | |
| self.height = height | |
| self.weight = weight | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Triangle(): | |
| def draw(): | |
| pass | |
| class Square(): | |
| def draw(): | |
| pass | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def __init__(self): | |
| name1 = input("p1 name") | |
| name2 = input("p2 name") | |
| self.p1 = Player(name1) | |
| self.p2 = Player(name2) | |
| self.deck = Deck() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib.request | |
| from bs4 import BeautifulSoup | |
| class Scraper: | |
| def __init__(self, site): | |
| self.site = site | |
| def scrape(self): | |
| r = urllib.request.urlopen(self.site) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for i in range(10): | |
| print("foo") | |
| for i in range(10): | |
| print("bar") | |
| for i in range(10): | |
| print("none") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def print_string(a_string): | |
| for i in range(10): | |
| print(a_string) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def print_string(a_string, x): | |
| for i in range(x): | |
| print(a_string) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def add_strings(string1, string2): | |
| print(string1 + string2) | |