- This event has passed.
4PM Python Level 1
May 25, 2019 @ 4:00 pm - 5:00 pm
- We reviewed Animal Quiz homework from page 39 to 41.
- We reviewed “convert_year_to_second” function homework.
- We reviewed Loops: for loop and while loop and how to break from loop.
- Homeworks:
- Create a “for loop” to print the following 5 times:
- ‘Hello world!’
- Create a program to do the following:
- Ask user in the shell, “How many times you want me to print? “.
- Save user input to variable “num_of_print”.
- Use “num_of_print” variable to print “Hello World” repeatedly. Use “for loop” to print repeatedly.
- For example this is how the program will do
-
How many times you want me to print? 3 Hello World Hello World Hello World
-
- Another example:
-
How many times you want me to print? 6 Hello World Hello World Hello World Hello World Hello World Hello World
-
- Create a program that will do the following:
- Ask user “How old are you? ” and save the user input to a variable “age”.
- Ask user “Are you a genius? ” and save the user input to a variable “genius”.
- Create a while loop with the following condition
- IF age is not equal to “bye” AND genius is not equal to “bye”.
- Inside the while loop do the following
- IF age is bigger than 16 OR genius is equal to “y” OR genius is equal to “yes” then print “You can go to college.”
- ELSE print “You cannot go to college.”
- Repeat asking input from shell “How old are you? ” save to “age” variable. And also ask from sheel “Are you a genius? ” save to “genius” variable.
- Do only “Exercise 1” in https://www.ayclogic.com/coding-in-python-level-1/star-wars-problem/
- Create a “for loop” to print the following 5 times: