INQ241A
Mobile Apps
Day 2 Notes
Loops
Review Star
- How to approach solving programming problems
- Can get, something star-like pretty easily by going foward and turning the same amount 5 times
- But the angle may be wrong
- Two ways to solve…
- Guess and check
- Calculate angle
Miscelanious Turtle
- Change color
♻turtle→set pen color(colors→random)
- Change thickness
♻turtle→set pen color(5)
- Change speed `
♻turtle→set speed(0)
- Be careful with speed, too fast may make it hard to see problems
- Can use it multiple times to go quickly through parts that are correct and slowly through new stuff
- Using the keyboard instead of the mouse
Loops
- Star code is very repetitive, we can simplify it
- Use a for loop to do something repeatedly
- for is a blue button at the top. The blue buttons are more commonly used peices of code that are always there to be more easily accessable
- Change the number of repetitions by changing the number at the end of the for line
- Code inside the for block, is executed top-to-bottom the specified number of times
- Another example, the equalateral triangle
Quiz
- In a web browser, go to socrative.com.
- Choose student login.
- Room name ‘INQ241’
Activity