BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//American Young Coder - ECPv6.10.1.1//NONSGML v1.0//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:American Young Coder
X-ORIGINAL-URL:https://www.ayclogic.com
X-WR-CALDESC:Events for American Young Coder
REFRESH-INTERVAL;VALUE=DURATION:PT1H
X-Robots-Tag:noindex
X-PUBLISHED-TTL:PT1H
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
BEGIN:DAYLIGHT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
DTSTART:20250309T100000
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
TZNAME:PST
DTSTART:20251102T090000
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=America/Los_Angeles:20250904T180000
DTEND;TZID=America/Los_Angeles:20250904T190000
DTSTAMP:20260514T224442
CREATED:20250905T021052Z
LAST-MODIFIED:20250905T021115Z
UID:30654-1757008800-1757012400@www.ayclogic.com
SUMMARY:6:00 PM- Python OOP -Joshua
DESCRIPTION:Today We Did\n\nfixed bugs\nreviewed to parts of an application\n\nHomework\nadd the two class functions (add_snack and list_snacks). Below I included not only the instructions\, but also an Example that when you run it\, it should look exactely like my example. Remember RUN YOUR CODE. Don’t stop until it works \nIf you look further\, I put an example with a “FRUIT STORE” look at it for help \n\n    def add_snack(self):\n\n        # 1. Use input 4 to ask for the information about the snack\n\n\n        #2 Is to create a snack using the information you asked for\n\n\n        #3  add it to the dictionary\n        pass\n\n    def list_all_snacks(self):\n        # do not do this -----< print(self.snack_dict)\n        # use a for loop to go one buy one and print everything from the dictionary\n        \n        #look at the fruit as an example\, but use one of the dictionary methods (such as dict_name.values)\n        # grab all the names of the dictionary\n        pass\n\n#You may need to test your code. vending_machine.add_snack()  <--- is how you would test it\n\n\n\n  \nWHAT IT SHOULD LOOK LIKE WHEN YOU RUN IT\nPlease select one of the following\n1. Add Snack\n2. list all snacks\n3. find snack\n4. list salty snacks\n5. list sweet snacks\nEnter your selection (Enter “exit” to quit): 1 \nADD SNACK \nWhat is the Snack’s Name? Chips\nWhat is the Snack’s Type/Flavor? Salty\nWhat is the Snack’s Size? Large\nIs the Snack Healthy? No \nPlease select one of the following\n1. Add Snack\n2. list all snacks\n3. find snack\n4. list salty snacks\n5. list sweet snacks\nEnter your selection (Enter “exit” to quit): 1 \nADD SNACK \nWhat is the Snack’s Name? Chocolate\nWhat is the Snack’s Type/Flavor? Sweet\nWhat is the Snack’s Size? Small\nIs the Snack Healthy? No \n  \nPlease select one of the following\n1. Add Snack\n2. list all snacks\n3. find snack\n4. list salty snacks\n5. list sweet snacks\nEnter your selection (Enter “exit” to quit): 2 \nList Snacks \nChips – Salty – Large \nChocolate – Sweet – Small \n  \n  \nExample you can borrow for our snack system \n\n# Part 1 Finish the Fruit class\n# just self. __________________\n# name and color is Strings\n# is_it_sweet is True or False\n# barcord_numberis number\nclass Fruit:\n\n    def __init__(self\,name\,color\,is_it_sweet\,barcode_number):\n        self.name = name\n        self.color = color\n        self.is_it_sweet = is_it_sweet\n        self.barcode_number = barcode_number\n\n\nclass Fruit_store:\n    # Part 2 I need you to create 2 empty dictionaries\n    # fruit_by_name {name:fruit}\n    # fruit_by_barcode {barcode:fruit}\n    def __init__ (self):\n        self.fruit_by_name = {}\n        self.fruit_by_barcode = {}\n\n    # part 3\n    # i want you to write the code that lets someone add a fruit to the store\n    def add_fruit(self):\n        name = input("What is the fruit's name?")\n        color = input("what is the fruit's color?")\n        is_it_sweet = input("is the fruit sweet?")\n        barcode_number = input("what is the barcode number of your fruit?")\n\n        fruit = Fruit(name\,color\,is_it_sweet\,barcode_number)\n\n        self.fruit_by_name[name] = fruit\n        self.fruit_by_barcode[barcode_number] = fruit\n        print("You have added your fruit")\n\n\n\n    # part 4\n    # pick a dictionary\, and use it to list all the fruit and its information\n    def list_fruit(self):\n        for f in self.fruit_by_name.values():\n            print(f"the fruit's name is{f.name}and the fruit's  {f.color}   {f.is_it_sweet}    {f.barcode_number}")\n\n\n\n\n    # part 5\n    # same as list_fruit\, but you must check if the fruit is sweet before printing\n    def find_all_sweet_fruit(self):\n        for f in self.fruit_by_name.values():\n            if f.is_it_sweet.lower() == "true":\n                print(f"the fruit's name is {f.name} and the fruit's  {f.color}   {f.is_it_sweet}    {f.barcode_number}")\n\n    #part 6\n    # the user will ask for a fruit with input\, and you need to print the info\n    def find_fruit_by_name(self):\n        question_of_fruit = input("what fruit are you looking for?")\n\n        if question_of_fruit in self.fruit_by_name.keys():\n            found_fruit = self.fruit_by_name[question_of_fruit]\n            print(f"the fruit's name is {found_fruit.name} and the fruit's  {found_fruit.color}   {found_fruit.is_it_sweet}    {found_fruit.barcode_number}")\n\n\n        else:\n            print("We don't have your fruit")\n\n    def application_loop(self):\n\n        menu = """ \n        1. Add A Fruit \n        2. List all fruits \n        3. find all sweet fruits\n        4. find fruits by name\n        5. End Application\n        Enter Your selection here:"""\n        while True:\n            response = input(menu)\n\n            if response=="1":\n                self.add_fruit()\n            elif response=="2":\n                self.list_fruit()\n            elif response == "4":\n                self.find_fruit_by_name()\n            elif response == "3":\n                self.find_all_sweet_fruit()\n            elif response == "5":\n                break\n            else:\n                print("Bad answer")\n\n\n\n\n\n\n\n\nranch_nine_nine= Fruit_store()\n#ranch_nine_nine.add_fruit() #<--- we do the code to add the fruit\nranch_nine_nine.application_loop()
URL:https://www.ayclogic.com/event/30654/
END:VEVENT
END:VCALENDAR