SlideShare a Scribd company logo
1 of 11
LESSON OBJECTIVES
Learn to use variables and ‘while’
loops to get keyboard input from
users.
LESSON OUTCOMES
 I can use variables in Python …
 I can use while loops in Python …
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=42variable
name
42
The variable’s
value
Outcomes:
 I can use variables in Python…
 I can use while loops in Python …
>>> my_number=0
while my_number < 10:
print (I love coding in
Python)
my_number = my_number+1
The variable is called number
The = operator gives the variable
a value 0.
This line of code says ‘while the
variable called number is
less than 10 do the
following.
All of the code that is indented
after the colon is to be
repeated by the computer – it
loops through these two lines
of code until number is no
longer less than 10.
WHILE LOOPS
Outcomes:
 I can use variables in Python…
 I can use while loops in Python …
TASK 1 – USING WHILE LOOPS
[ slide 4 ]
Open the following file: While loop.
When the file is open enter your own print output in the
print function brackets.
>>> my_number=0
>>> while my_number < 10:
print("I love coding in Python!")
my_number = my_number+1
Outcomes:
 I can use variables in Python…
 I can use while loops in Python …
When you have completed the above code attempt Task 1 on worksheet 3.
MINI PLENARY
Look at the following code:
x=0
while x<5:
print('looping')
When do you think the code will stop
looping.
Outcomes:
 I can use variables in Python…
 I can use while loops in Python …
MAIN TASK 2
Have a go at completing
Tasks 2 and 3
on the worksheet.
Outcomes:
 I can use variables in Python…
 I can use while loops in Python …
WORKSHEET ANSWERS
Outcomes:
 I can use variables in Python…
 I can use while loops in Python …
PLENARY
Can you explain what the program lines are
doing?
Outcomes:
 I can use variables in Python…
 I can use while loops in Python …
ANSWER
Outcomes:
 I can use variables in Python…
 I can use while loops in Python …

More Related Content

Similar to Year 7 lesson 3 variables and while loops

Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3aRuth Marvin
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
 
Python Introduction Week-1 Term-3.pptx
Python Introduction Week-1 Term-3.pptxPython Introduction Week-1 Term-3.pptx
Python Introduction Week-1 Term-3.pptxMohammad300758
 
if, while and for in Python
if, while and for in Pythonif, while and for in Python
if, while and for in PythonPranavSB
 
Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...
Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...
Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...Lucky Gods
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming LanguageDipankar Achinta
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptxHaythamBarakeh1
 
This is all about control flow in python intruducing the Break and Continue.pptx
This is all about control flow in python intruducing the Break and Continue.pptxThis is all about control flow in python intruducing the Break and Continue.pptx
This is all about control flow in python intruducing the Break and Continue.pptxelezearrepil1
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdfgmadhu8
 
Notes2
Notes2Notes2
Notes2hccit
 
Engineering CS 5th Sem Python Module-1.pptx
Engineering CS 5th Sem Python Module-1.pptxEngineering CS 5th Sem Python Module-1.pptx
Engineering CS 5th Sem Python Module-1.pptxhardii0991
 

Similar to Year 7 lesson 3 variables and while loops (20)

Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
 
Module-1.pptx
Module-1.pptxModule-1.pptx
Module-1.pptx
 
Python basics
Python basicsPython basics
Python basics
 
Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3a
 
Python made easy
Python made easy Python made easy
Python made easy
 
Python programming
Python programmingPython programming
Python programming
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
lecture 2.pptx
lecture 2.pptxlecture 2.pptx
lecture 2.pptx
 
Python Introduction Week-1 Term-3.pptx
Python Introduction Week-1 Term-3.pptxPython Introduction Week-1 Term-3.pptx
Python Introduction Week-1 Term-3.pptx
 
python into.pptx
python into.pptxpython into.pptx
python into.pptx
 
if, while and for in Python
if, while and for in Pythonif, while and for in Python
if, while and for in Python
 
Python by Rj
Python by RjPython by Rj
Python by Rj
 
Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...
Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...
Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming Language
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
 
This is all about control flow in python intruducing the Break and Continue.pptx
This is all about control flow in python intruducing the Break and Continue.pptxThis is all about control flow in python intruducing the Break and Continue.pptx
This is all about control flow in python intruducing the Break and Continue.pptx
 
Python for Beginners(v1)
Python for Beginners(v1)Python for Beginners(v1)
Python for Beginners(v1)
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdf
 
Notes2
Notes2Notes2
Notes2
 
Engineering CS 5th Sem Python Module-1.pptx
Engineering CS 5th Sem Python Module-1.pptxEngineering CS 5th Sem Python Module-1.pptx
Engineering CS 5th Sem Python Module-1.pptx
 

More from tmoncrieff

Lesson 3-health-and-safety
Lesson 3-health-and-safetyLesson 3-health-and-safety
Lesson 3-health-and-safetytmoncrieff
 
Lesson 2-human-computer
Lesson 2-human-computerLesson 2-human-computer
Lesson 2-human-computertmoncrieff
 
Lesson 4 binary numbers
Lesson 4   binary numbersLesson 4   binary numbers
Lesson 4 binary numberstmoncrieff
 
Lesson 1 inputs and outputs
Lesson 1   inputs and outputsLesson 1   inputs and outputs
Lesson 1 inputs and outputstmoncrieff
 
Lesson 4 binary numbers
Lesson 4   binary numbersLesson 4   binary numbers
Lesson 4 binary numberstmoncrieff
 
Lesson 3-health-and-safety
Lesson 3-health-and-safetyLesson 3-health-and-safety
Lesson 3-health-and-safetytmoncrieff
 
Lesson 2-human-computer
Lesson 2-human-computerLesson 2-human-computer
Lesson 2-human-computertmoncrieff
 
Lesson 1 inputs and outputs
Lesson 1   inputs and outputsLesson 1   inputs and outputs
Lesson 1 inputs and outputstmoncrieff
 
Year 7 lesson 5 if statements
Year 7 lesson 5   if statementsYear 7 lesson 5   if statements
Year 7 lesson 5 if statementstmoncrieff
 
Lesson 1 inputs and outputs
Lesson 1   inputs and outputsLesson 1   inputs and outputs
Lesson 1 inputs and outputstmoncrieff
 
16 btec12 first_bus_u8_ps2
16 btec12 first_bus_u8_ps216 btec12 first_bus_u8_ps2
16 btec12 first_bus_u8_ps2tmoncrieff
 
17 btec12 first_bus_u8_ps3
17 btec12 first_bus_u8_ps317 btec12 first_bus_u8_ps3
17 btec12 first_bus_u8_ps3tmoncrieff
 
15 btec12 first_bus_u8_ps1
15 btec12 first_bus_u8_ps115 btec12 first_bus_u8_ps1
15 btec12 first_bus_u8_ps1tmoncrieff
 
04 btec12 first_bus_u3_pp1
04 btec12 first_bus_u3_pp104 btec12 first_bus_u3_pp1
04 btec12 first_bus_u3_pp1tmoncrieff
 

More from tmoncrieff (14)

Lesson 3-health-and-safety
Lesson 3-health-and-safetyLesson 3-health-and-safety
Lesson 3-health-and-safety
 
Lesson 2-human-computer
Lesson 2-human-computerLesson 2-human-computer
Lesson 2-human-computer
 
Lesson 4 binary numbers
Lesson 4   binary numbersLesson 4   binary numbers
Lesson 4 binary numbers
 
Lesson 1 inputs and outputs
Lesson 1   inputs and outputsLesson 1   inputs and outputs
Lesson 1 inputs and outputs
 
Lesson 4 binary numbers
Lesson 4   binary numbersLesson 4   binary numbers
Lesson 4 binary numbers
 
Lesson 3-health-and-safety
Lesson 3-health-and-safetyLesson 3-health-and-safety
Lesson 3-health-and-safety
 
Lesson 2-human-computer
Lesson 2-human-computerLesson 2-human-computer
Lesson 2-human-computer
 
Lesson 1 inputs and outputs
Lesson 1   inputs and outputsLesson 1   inputs and outputs
Lesson 1 inputs and outputs
 
Year 7 lesson 5 if statements
Year 7 lesson 5   if statementsYear 7 lesson 5   if statements
Year 7 lesson 5 if statements
 
Lesson 1 inputs and outputs
Lesson 1   inputs and outputsLesson 1   inputs and outputs
Lesson 1 inputs and outputs
 
16 btec12 first_bus_u8_ps2
16 btec12 first_bus_u8_ps216 btec12 first_bus_u8_ps2
16 btec12 first_bus_u8_ps2
 
17 btec12 first_bus_u8_ps3
17 btec12 first_bus_u8_ps317 btec12 first_bus_u8_ps3
17 btec12 first_bus_u8_ps3
 
15 btec12 first_bus_u8_ps1
15 btec12 first_bus_u8_ps115 btec12 first_bus_u8_ps1
15 btec12 first_bus_u8_ps1
 
04 btec12 first_bus_u3_pp1
04 btec12 first_bus_u3_pp104 btec12 first_bus_u3_pp1
04 btec12 first_bus_u3_pp1
 

Recently uploaded

Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 

Recently uploaded (20)

Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 

Year 7 lesson 3 variables and while loops

  • 1.
  • 2. LESSON OBJECTIVES Learn to use variables and ‘while’ loops to get keyboard input from users.
  • 3. LESSON OUTCOMES  I can use variables in Python …  I can use while loops in Python …
  • 4. 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=42variable name 42 The variable’s value Outcomes:  I can use variables in Python…  I can use while loops in Python …
  • 5. >>> my_number=0 while my_number < 10: print (I love coding in Python) my_number = my_number+1 The variable is called number The = operator gives the variable a value 0. This line of code says ‘while the variable called number is less than 10 do the following. All of the code that is indented after the colon is to be repeated by the computer – it loops through these two lines of code until number is no longer less than 10. WHILE LOOPS Outcomes:  I can use variables in Python…  I can use while loops in Python …
  • 6. TASK 1 – USING WHILE LOOPS [ slide 4 ] Open the following file: While loop. When the file is open enter your own print output in the print function brackets. >>> my_number=0 >>> while my_number < 10: print("I love coding in Python!") my_number = my_number+1 Outcomes:  I can use variables in Python…  I can use while loops in Python … When you have completed the above code attempt Task 1 on worksheet 3.
  • 7. MINI PLENARY Look at the following code: x=0 while x<5: print('looping') When do you think the code will stop looping. Outcomes:  I can use variables in Python…  I can use while loops in Python …
  • 8. MAIN TASK 2 Have a go at completing Tasks 2 and 3 on the worksheet. Outcomes:  I can use variables in Python…  I can use while loops in Python …
  • 9. WORKSHEET ANSWERS Outcomes:  I can use variables in Python…  I can use while loops in Python …
  • 10. PLENARY Can you explain what the program lines are doing? Outcomes:  I can use variables in Python…  I can use while loops in Python …
  • 11. ANSWER Outcomes:  I can use variables in Python…  I can use while loops in Python …