- Slides: 16
PROGRAMMING Sequence, Selection, Iteration
AIM: • What are sequence, iteration, and selection? SUCCESS CRITERIA: • Using Small Basic you can create several programs using sequence, iteration and selection
STARTER Write a program to say “Bonjour le monde” HINT: Use Text. Window. Write. Line() to do this. Can you write the same program using languages from around the world?
SEQUENCE 1. Choose the sweet you want 2. Remove the wrapper 3. Eat the sweet 1. Remove the wrapper 2. Choose the sweet you want 3. Eat the sweet 1. Choose the sweet you want 2. Eat the sweet 3. Remove the wrapper
DEMO: SEQUENCE Turtle. Show() Turtle. Move(100 ) Turtle. Turn(90) Turtle. Hide()
ACTIVITY 1: SEQUENCE Use the commands below in various combinations to see what you can create. Turtle. Show() Turtle. Move(100 ) Turtle. Turn(90) Turtle. Hide()
ITERATION Do this until the tin is empty 1. Choose the sweet you want 2. Remove the wrapper 3. Eat the sweet Repeat
DEMO: ITERATION For i = 1 to 4 Turtle. Move(100 ) Turtle. Turn(90) Endfor
ACTIVITY 2: ITERATION Use the code below to draw a square. For i = 1 to 4 Turtle. Move(100 ) Turtle. Turn(90) Endfor
ACTIVITY: ITERATION CHALLENGES … BRONZE Use the For loop to create other shapes, including a triangle, hexagon, pentagon and circle. SILVER Experiment with Graphics. Window. Pen. Color=“red“ and other colours in your code. GOLD Put the For loop code within another For loop (nested) and turn the turtle by 5 o each time. What geometric shapes can you create? Use the code above in your loop.
SELECTION If your favourite sweet is there, take it. If your favourite sweet is not there, take your next favourite sweet. If your next favourite sweet is not there, take your next favourite sweet. and so on …
ACTIVITY 3: ITERATION CHALLENGES … BRONZE Use IF, THEN and ELSE to write your own IF selection statement. SILVER Experiment using ELSEIF to create several of your own questions using the IF selection statement. GOLD Create a menu system using the IF selection statement, and incorporate the turtle shape code in your program
PLENARY: “Programming is our only super power!” http: //youtu. be/n. KIu 9 yen 5 nc
PROGRAMMING: “Our only super power! “Not unlike playing an instrument or playing a sport” “You don’t have to be a genius to know how to code. “Do you need to be a genius to read? ” “You need to be determined. ” “An incredibly empowering skill to learn” “Software is really about humanity. It’s about helping people by using computer technology” “Today’s programmers are tomorrow’s rock stars!