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
__author__ = 'Jonathan' | |
class Bicycle(object): | |
def __init__(self, modelname, weight, cost): | |
self.modelname = modelname | |
self.weight = weight | |
self.cost = cost | |
class BikeShop(object): | |
def __init__(self, name, inventory, prod_cost): |
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
__author__ = 'Jonathan' | |
class Musician(object): | |
def __init__(self, sounds): | |
self.sounds = sounds | |
def solo(self, length): | |
for i in range(length): | |
print(self.sounds[i % len(self.sounds)],) | |
print("") |
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
__author__ = 'Jonathan' | |
import random | |
questions = { | |
"strong": "Do ye like yer drinks strong?", | |
"salty": "Do ye like it with a salty tang?", | |
"bitter": "Are ye a lubber who likes it bitter?", | |
"sweet": "Would ye like a bit of sweetness with yer poison?", | |
"fruity": "Are ye one for a fruity finish?" |
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
__author__ = 'Jonathan' | |
while True: | |
try: | |
biggestnum = int(input("How many numbers should we count to? ")) | |
if biggestnum <= 0: | |
raise ValueError | |
break | |
except ValueError: | |
print("That's not a positive integer.") |
NewerOlder