Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fill the screen challenge! This is a starter activity and should take 3 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.In interactive mode,

Similar presentations


Presentation on theme: "Fill the screen challenge! This is a starter activity and should take 3 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.In interactive mode,"— Presentation transcript:

1 Fill the screen challenge! This is a starter activity and should take 3 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.In interactive mode, fill your screen with the name of your favourite food. Hint: Use the print() function.

2 Lesson Aims 1.variables 2.the while loop 3.comparative operators [ slide 2 ] Vocabulary variable equals operator comparative operator In this lesson you are going to learn about:

3 Variables [ slide 3 ] A variable is a space in the computer ’ s memory where we can store data such as a number or text. The value can be changed if required. The box represents the space reserved in the computer ’ s memory To create a variable and give it the value 42 we write: >>> my_number=42 my_number variable name 42 The variable ’ s value

4 While Loops [ slide 4 ] Now try entering this code in IDLE: >>> my_number=0 >>> while my_number < 10: print("I love coding in Python!") my_number = my_number+1 Then press the RETURN key twice. Notice how we create a variable and give it the number 0. Can you see how each time through the loop we add 1 to it and then give the new value to the same variable?

5 The Equals Operator [ slide 5 ] To give a value to a variable we use the equals operator. Note how this is very different to the way it is used in maths! >>> my_number=42 The equals operator in action!

6 Coding Time [ slide 6 ] 1.Read pages 22 and 23 of Python Basics and try out Code Boxes 2.4 and 2.6 2.Read page 24 3.See if you can re-write the code in Code Box 2.6 so it does the same thing but with this new start: >>> number=1 >>> while number != 101: print(number) number = number+1

7 Homework See how many of the puzzles you can do from pages 26 and 27 in Python Basics in 30 minutes. (Puzzle 3 can prove difficult – look back at page 25 and remember that the variable number does not have to go before the integer you choose in the while clause.) [ slide 7 ]

8 Lesson Summary To create a variable called num and give it the value 42 we write... [ slide 8 ] In this lesson you have learnt about: num=42 The equals operator is used to give a value to... a variable There are several comparative operators. Do you know them all... == != > = <= 1.variables 2.while loops 3.comparative operators


Download ppt "Fill the screen challenge! This is a starter activity and should take 3 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.In interactive mode,"

Similar presentations


Ads by Google