American Young Coder

AYC logo
Loading Events

« All Events

  • This event has passed.

6PM Python Level 1

October 27, 2018 @ 6:00 pm - 7:00 pm

  1. We went over last week homework: https://www.ayclogic.com/event/6pm-python-level-1-3/
    1. Doing for loop
    2. Doing While loop with break and if statement
  2. Homework
    1. We are going to create a similar project like “Ask Gobo” project in the Scratch White book page 60 to 65.
    2. Create a new python file call it “HomeworkOct27-Magic8Ball.py”
    3. On top of the file put the following line “import random”
    4. Create a while loop (like last week homework) which will do the following
      1. Ask user “Enter yes or no question.” and take user input and save/set user input into a variable called “userQuestion”.
      2. If user input is “quit”, print “Bye bye” and break from the While Loop.
      3. Generate random number between 1 to 8
        1. to generate random number between 1 to 8 do the following “random.randrange(1,8)” and save/set random number into variable called “randomNumber”.
      4. Inside the while loop print to the screen according to “randomNumber”
        1. If randomNumber is equal to 1, print “It is certain.”
        2. If randomNumber is equal to 2, print “Most likely.”
        3. If randomNumber is equal to 3, print “Signs point to yes.”
        4. If randomNumber is equal to 4, print “I don’t so.”
        5. If randomNumber is equal to 5, print “Ask again later.”
        6. If randomNumber is equal to 6, print “Concentrate and ask again.”
        7. If randomNumber is equal to 7, print “Outlook not so good.”
        8. If randomNumber is equal to 8, print “My reply is no.”
      5. After printing the answer, go back to Step 1 (Ask user “Enter yes or no question”) until user input “quit”.

Details

Date:
October 27, 2018
Time:
6:00 pm - 7:00 pm
Event Categories:
,