« All Events
3PM Python Level 1
February 2, 2019 @ 3:00 pm - 4:00 pm
- We went over Loopy Loop chapter from page 32 to 35.
- We learned about “for loops”.
- We learned about “while loops”.
- We learned about “Infinite loops”.
- We learned about “Nested loops”.
- Homeworks:
- Using “for loops” print “Are we there yet?” to shell 5 times. The result would look like below
Are we there yet?
Are we there yet?
Are we there yet?
Are we there yet?
Are we there yet?
- Change the code in the previous question to also prefix “Are we there yet” with a number like the following:
2 Are we there yet?
3 Are we there yet?
4 Are we there yet?
5 Are we there yet?
6 Are we there yet?
- Using “while loops” do the following forever:
- Print “Give me your age?”
- If the user enters “bye” quit the loop. Look at page 34 for code on how to break from the infinite loop.
- If the user enters 0 print “You are a newborn baby”.
- If the user enters any number smaller than 4 then print “You are a toddler”.
- If the user enters any number smaller than 13 then print “You are a kid”.
- If the user enters any number smaller than 20 then print “You are a teenager”.
- If the user enters any number smaller than 40 then print “You are an adult”.
- If the user enters any number greater than or equal to 40 then print “Dude!! You are old.”
- Repeat the process to #1 (“Give me your age?”)
- Using two nested “for loops” print the following:
ready
ready
ready
Jump
ready
ready
ready
Jump
- Using two nested “for loops” print the following:
1
2
3
go
1
2
3
go
1
2
3
go