American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

5 PM – Intro To Python – Gamas

November 20 @ 5:00 pm - 6:00 pm

Today We Did
  1. We reviewed homework
  2. We continued with grocery_shopping_cart.py
Homework
  1. Create nov_20_random_hw2.py and copy and paste this code and tell me what it is doing
    1. import random as r
      
      cars = []
      cars.append("honda")
      cars.append("hyundai")
      cars.append("toyota")
      
      random_car = r.choice(cars)
      print(random_car)
  2. Inside your oct_30_grocery_shopping_cart.py
    1. Change the code, so you can add “Egg”, “Milk” and “Orange Juice” to the purchased_item list. This is very similar to what you did in nov_13_elements_practice_hw.py homework
    2. After the while loop, you have to use for loop to go through each element inside the “purchased_item” list and print the item. This is also very similar to what you did in nov_13_elements_practice_hw.py.
    3. If you do it properly, your program will do like the following
      1. What do you want to purchase: 
        1. Milk - $5
        2. Eggs - $3
        3. Orange Juice - $6
        Enter your selection 1 to 3 (Enter 'exit' for quit): 1
        You have purchased Milk for $5
        
        What do you want to purchase: 
        1. Milk - $5
        2. Eggs - $3
        3. Orange Juice - $6
        Enter your selection 1 to 3 (Enter 'exit' for quit): 1
        You have purchased Milk for $5
        
        What do you want to purchase: 
        1. Milk - $5
        2. Eggs - $3
        3. Orange Juice - $6
        Enter your selection 1 to 3 (Enter 'exit' for quit): 2
        You have purchased Egg for $3
        
        What do you want to purchase: 
        1. Milk - $5
        2. Eggs - $3
        3. Orange Juice - $6
        Enter your selection 1 to 3 (Enter 'exit' for quit): 3
        You have purchased Orange Juice for $6
        
        What do you want to purchase: 
        1. Milk - $5
        2. Eggs - $3
        3. Orange Juice - $6
        Enter your selection 1 to 3 (Enter 'exit' for quit): exit
        
        You have purchased the following items:
        Milk
        Milk
        Egg
        Orange Juice
        You have to pay $19.
  3. Create nov_20_turtle_green_grapes_hw.py and draw the following drawing using python turtle
    1. Copy the rectangle and circle functions from your old projects
    2. There should be total of 23 grapes
      1. 1st row 5 grapes
      2. 2nd row 6 grapes
      3. 3rd row 5 grapes
      4. 4th row 4 grapes
      5. 5th row 2 grapes
      6. 6th row or bottom row 1 grape

Details

Date:
November 20
Time:
5:00 pm - 6:00 pm
Verified by MonsterInsights