Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions homework_lec_1_and_2/compare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# list1=[1, 2.7, "Hi", 1] # for testing
# list2=[1, 2.7, "Hi", 1] # for testing

list1=input("Enter list1 with '[]' or '()' and ',' ")
list2=input("Enter list2 with '[]' or '()' and ',' ")

def compare_lists(list1,list2):
count = 0 # for now that this is end of lists
if ((type(list1) == type(list2)) and (len(list1)==len(list2))): # compare type and length of our lists
for i in list1:
if id(i) == id(list2[(list1.index(i))]): # or if (type(i)== type(list2[(list1.index(i))]) and i==list2[(list1.index(i))]):
count += 1 # if compare type and value of our lists is True
if len(list1) == count: # this is the last element of our list
return True
return False # if at least one condition isn't made

print("Result of list1 = ", list1, "and", "list2 = ", list2)
print("is ", compare_lists(list1,list2))
67 changes: 67 additions & 0 deletions homework_lec_1_and_2/pizza.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
class Pizza:
def prepare_base(self):
print("Start cooking!")
print("On the basis we put: ")

def prepare_ingredients(self):
pass

def __cook(self):
pass


class PizzaMeat(Pizza):
def prepare_ingredients(self):
print("sauce, onions,tomato, cucumbers, meal, olives and sprinkle with cheese!")
self.__cook()

def __cook(self):
print("We send it to the oven for 20 minutes...")
print("Meat pizza is done! Enjoy!")


class PizzaVegetable(Pizza):
def prepare_ingredients(self):
print("sauce, tomato, mozzarella, basil and sprinkle with cheese!")
self.__cook()

def __cook(self):
print("We send it to the oven for 15 minutes...")
print("Vegetable pizza is done!")


class PizzaMushroom(Pizza):
def prepare_ingredients(self):
print("sauce, mushrooms, onions, dill and sprinkle with cheese!")
self.__cook()

def __cook(self):
print("We send it to the oven for 17 minutes...")
print("Mushroom pizza is done!")


# scenario
while 1:
try:
pizza_type = int(input("Enter type's pizza(1-meat, 2-vegetable, 3-mushroom) for cooking: "))
break
except ValueError:
print("Incorrect input! It isn't number.")

if pizza_type == 1:
pizza_meat = PizzaMeat()
pizza_meat.prepare_base()
pizza_meat.prepare_ingredients()

elif pizza_type == 2:
pizza_vegetable = PizzaVegetable()
pizza_vegetable.prepare_base()
pizza_vegetable.prepare_ingredients()

elif pizza_type == 3:
pizza_mushroom = PizzaMushroom()
pizza_mushroom.prepare_base()
pizza_mushroom.prepare_ingredients()

else:
print("This number isn't on the menu! Good bay!")