class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self, value):
self.head = Node(value)
def append(self, value):
cur = self.head
while cur.next is not None:
cur = cur.next
cur.next = Node(value)
def get_kth_node_from_last(self, k):
l = []
cur = self.head
while cur.next != None:
l.append(cur.data)
cur = cur.next
return l[-k]
linked_list = LinkedList(6)
linked_list.append(7)
linked_list.append(8)
# print(linked_list.get_kth_node_from_last(2)) # 7이 나와야 합니다!
shop_menus = ["만두", "떡볶이", "오뎅", "사이다", "콜라"]
shop_orders = ["오뎅", "콜라", "만두"]
def is_available_to_order(menus, orders):
i = 0
cnt = 0
while i < len(shop_orders):
j = 0
while j < len(shop_menus):
if shop_orders[i] == shop_menus[j]:
cnt += 1
break
j += 1
i += 1
if cnt == 3:
return True
else:
return False
result = is_available_to_order(shop_menus, shop_orders)
# print(result)