American Young Coder

AYC logo
Loading Events

« All Events

  • This event has passed.

6:00PM: Python OOP- Joshua

July 24 @ 6:00 pm - 7:00 pm

Today we did

  • finish our library system

 

Homework

  • Look at your emails for an email containing the homework file 7_24_dict_class_homework

You have 6 parts

Part 1:

Finish creating the fruit class  __init__ function

Part 2

I want you to create two class variables in our Fruit_stores __init__ function.

Each one will be empty dictionaries and store the following information

# fruit_by_name {name:fruit object}
# fruit_by_barcode {barcode:fruit object}

Part 3

I want you to write the function (“add_fruit(self)”)

Step 1: You need to ask the user with input all the information about a fruit

Step 2: create a instance of a fruit (i.e create a fruit based on the inputs they give you)

Step 3: Add that fruit to both empty dictionaries correctly

Part 4

1 need you to finish the list_fruits(self) function. I want you to pick a dictioanry, then similar to library system, print all the information about every fruit

HINT: You need a for loop combined with   .keys(), .values(), or .items(). Don’t be afraid to use google to figure out how to use them

Part 5

Very similar to part 4, but you need to check if the fruit is sweet first. if the fruit is sweet, only then do you print the information

Hint: you need to use if

Part 6

Implement a search function where it uses input to ask the user what fruit you are looking for, and then you look for its information with a for loop

 

Details

Date:
July 24
Time:
6:00 pm - 7:00 pm