This file contains 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 Library: | |
d1 = {} | |
def __init__(self): | |
pass | |
def add_book(self,book): | |
self.d1[book] = True | |
def check_out_book(self,book): | |
if book in self.d1: | |
del(self.d1[book]) |
This file contains 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 FoodCalculator: | |
current_price = 0 | |
def __init__(self): | |
pass | |
def add_item(self,value): | |
self.current_price = value #assign to instance variable | |
def get_tax(self,tax_rate): | |
return self.current_price*(tax_rate*0.01) | |
def get_tip(self,taxP,tipP): | |
after_tax = self.current_price+(0.01*taxP*self.current_price) |
This file contains 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 Incrementor: | |
array = [] | |
value = 0 | |
arrayVals = [] | |
def __init__(self,array): | |
self.array = array | |
def add_value(self,value): | |
self.value = value | |
def add_values(self,valuesArr): | |
self.arrayVals = valuesArr |
This file contains 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 ShoppingList: | |
cart = {} | |
def __init__(self): | |
pass | |
def add_item(self,name,price): | |
self.cart[name] = price | |
def remove_item(self,name): | |
if name in self.cart: |
OlderNewer