SlideShare a Scribd company logo
Resources created by Andy Colley (@MrAColley)
Learning Goals/Objectives
Be able to read, comprehend, trace, adapt and create
Python code that:
• Performs simple maths (addition, subtraction, multiplication,
division and integer division) using fixed numbers
• Performs simple maths using numbers stored in variables
• Converts strings to integers
• Gets number input and uses it in calculations
Resources created by Andy Colley (@MrAColley)
Maths - Operators
2 + 2
Resources created by Andy Colley (@MrAColley)
Maths - Operators
+ addition
- subtraction
* multiplication
/ division (with decimal)
// division (integer result)
Resources created by Andy Colley (@MrAColley)
Input
Data is collected and sent to the
computer
Process
Carrying out instructions.
Output
Presenting the results of
processing back to the user
Storage
Saving data that is not in use.
Resources created by Andy Colley (@MrAColley)
Programming – Operators - Predict & Run
https://repl.it/@MrAColley/21-Maths-part-1
Resources created by Andy Colley (@MrAColley)
Maths With Variables
num1 = 5
num2 = 10
result = num1 + num2
print(result)
Assign numbers
to your variables.
Perform the calculation.
Assign the result to a NEW
VARIABLE.
Don’t forget to
output the result
Resources created by Andy Colley (@MrAColley)
Variables - vary - changing data
favColour
“blue”
Resources created by Andy Colley (@MrAColley)
Programming – Variable Maths – Modify & Make
score = 0
print(score)
score = 10
print(score)
Resources created by Andy Colley (@MrAColley)
Changing Variables With Maths
score = 0
print(score)
score = 10
print(score)
score = 0
print(score)
score = score + 1
print(score)
score = 0
print(score)
score += 1
print(score)
lives -= 1
Resources created by Andy Colley (@MrAColley)
Programming – Input & Variables - Integers
Input works with strings. Strings are text.
Computers can’t do maths/logic with text. They have to use
numbers.
Whole numbers are called integers (ints for short).
We have to write code to convert our string input to an int
before we can do maths with it.
Resources created by Andy Colley (@MrAColley)
Programming – Input & Variables - Integers
num1 = int(input("Enter a number"))
Tells the computer
to convert to an
integer.
Tells the computer
to convert to an
integer.
BRACKETS!
Because syntax!
Resources created by Andy Colley (@MrAColley)
Programming – Input & Variables - Integers
print(str(num1)
Tells the computer
to convert an
integer variable to a
string
Resources created by Andy Colley (@MrAColley)
Task 5 - Homework Challenge - Area
Calc
Create a program that allows the user to enter 2 numbers representing
the width and length of a rectangle. The program calculates and
displays the area of the rectangle.
Example solution -
https://repl.it/@MrAColley/25ChallengeExampleSolution
Resources created by Andy Colley (@MrAColley)
Extra Credit Challenges
Perimeter Calc
Create a program that allows the user to enter 2 numbers representing the width and
length of a rectangle. The program calculates and displays the perimeter of the
rectangle.
Restaurant Tip Calculator
Create a program that allows the user to enter the price of a meal at a restaurant. The
program calculates the amount of the tip to be paid at 20%. The tip and total price are
then displayed separately.
Volume and Surface Calc
Create a program that allows the user to enter 3 numbers representing the height, width
and length of a cuboid. The program calculates and displays the volume and total
surface area of the cuboid.

More Related Content

Similar to Creating Python Variables using Replit software (20)

Some hours of python
Some hours of pythonSome hours of python
Some hours of python
Things Lab
 
Python Objects
Python ObjectsPython Objects
Python Objects
MuhammadBakri13
 
Python Math Concepts Book
Python Math Concepts BookPython Math Concepts Book
Python Math Concepts Book
Rohan Karunaratne
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
VijaySharma802
 
An Introduction To Python - Variables, Math
An Introduction To Python - Variables, MathAn Introduction To Python - Variables, Math
An Introduction To Python - Variables, Math
Blue Elephant Consulting
 
Python basics
Python basicsPython basics
Python basics
Bladimir Eusebio Illanes Quispe
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
Rakotoarison Louis Frederick
 
"Solutions for Exercises" in Starting Out with Python 4th Global Edition by T...
"Solutions for Exercises" in Starting Out with Python 4th Global Edition by T..."Solutions for Exercises" in Starting Out with Python 4th Global Edition by T...
"Solutions for Exercises" in Starting Out with Python 4th Global Edition by T...
solution9159
 
Presentation1 (1).pptx
Presentation1 (1).pptxPresentation1 (1).pptx
Presentation1 (1).pptx
BodapatiNagaeswari1
 
Programming python quick intro for schools
Programming python quick intro for schoolsProgramming python quick intro for schools
Programming python quick intro for schools
Dan Bowen
 
Python programming unit 2 -Slides-3.ppt
Python programming  unit 2 -Slides-3.pptPython programming  unit 2 -Slides-3.ppt
Python programming unit 2 -Slides-3.ppt
geethar79
 
The python fundamental introduction part 1
The python fundamental introduction part 1The python fundamental introduction part 1
The python fundamental introduction part 1
DeoDuaNaoHet
 
03-Variables, Expressions and Statements (1).pdf
03-Variables, Expressions and Statements (1).pdf03-Variables, Expressions and Statements (1).pdf
03-Variables, Expressions and Statements (1).pdf
MirHazarKhan1
 
CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1
Buxoo Abdullah
 
Class 2: Welcome part 2
Class 2: Welcome part 2Class 2: Welcome part 2
Class 2: Welcome part 2
Marc Gouw
 
Review old Pygame made using python programming.pptx
Review old Pygame made using python programming.pptxReview old Pygame made using python programming.pptx
Review old Pygame made using python programming.pptx
ithepacer
 
Pythonlearn-02-Expressions123AdvanceLevel.pptx
Pythonlearn-02-Expressions123AdvanceLevel.pptxPythonlearn-02-Expressions123AdvanceLevel.pptx
Pythonlearn-02-Expressions123AdvanceLevel.pptx
AninditaSarkarNaha
 
Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)
ExcellenceAcadmy
 
Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)
ExcellenceAcadmy
 
python isn't just a snake
python isn't just a snakepython isn't just a snake
python isn't just a snake
geekinlibrariansclothing
 
Some hours of python
Some hours of pythonSome hours of python
Some hours of python
Things Lab
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
VijaySharma802
 
An Introduction To Python - Variables, Math
An Introduction To Python - Variables, MathAn Introduction To Python - Variables, Math
An Introduction To Python - Variables, Math
Blue Elephant Consulting
 
"Solutions for Exercises" in Starting Out with Python 4th Global Edition by T...
"Solutions for Exercises" in Starting Out with Python 4th Global Edition by T..."Solutions for Exercises" in Starting Out with Python 4th Global Edition by T...
"Solutions for Exercises" in Starting Out with Python 4th Global Edition by T...
solution9159
 
Programming python quick intro for schools
Programming python quick intro for schoolsProgramming python quick intro for schools
Programming python quick intro for schools
Dan Bowen
 
Python programming unit 2 -Slides-3.ppt
Python programming  unit 2 -Slides-3.pptPython programming  unit 2 -Slides-3.ppt
Python programming unit 2 -Slides-3.ppt
geethar79
 
The python fundamental introduction part 1
The python fundamental introduction part 1The python fundamental introduction part 1
The python fundamental introduction part 1
DeoDuaNaoHet
 
03-Variables, Expressions and Statements (1).pdf
03-Variables, Expressions and Statements (1).pdf03-Variables, Expressions and Statements (1).pdf
03-Variables, Expressions and Statements (1).pdf
MirHazarKhan1
 
CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1
Buxoo Abdullah
 
Class 2: Welcome part 2
Class 2: Welcome part 2Class 2: Welcome part 2
Class 2: Welcome part 2
Marc Gouw
 
Review old Pygame made using python programming.pptx
Review old Pygame made using python programming.pptxReview old Pygame made using python programming.pptx
Review old Pygame made using python programming.pptx
ithepacer
 
Pythonlearn-02-Expressions123AdvanceLevel.pptx
Pythonlearn-02-Expressions123AdvanceLevel.pptxPythonlearn-02-Expressions123AdvanceLevel.pptx
Pythonlearn-02-Expressions123AdvanceLevel.pptx
AninditaSarkarNaha
 
Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)
ExcellenceAcadmy
 
Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)
ExcellenceAcadmy
 

More from afsheenfaiq2 (19)

object oriented porgramming using Java programming
object oriented porgramming using Java programmingobject oriented porgramming using Java programming
object oriented porgramming using Java programming
afsheenfaiq2
 
Object oriented programming design and implementation
Object oriented programming design and implementationObject oriented programming design and implementation
Object oriented programming design and implementation
afsheenfaiq2
 
Anime Display for Weekly Passion Hour Club
Anime Display for Weekly Passion Hour ClubAnime Display for Weekly Passion Hour Club
Anime Display for Weekly Passion Hour Club
afsheenfaiq2
 
Introduction to Declaring Functions in Python
Introduction to Declaring Functions in PythonIntroduction to Declaring Functions in Python
Introduction to Declaring Functions in Python
afsheenfaiq2
 
Sample Exam Questions on Python for revision
Sample Exam Questions on Python for revisionSample Exam Questions on Python for revision
Sample Exam Questions on Python for revision
afsheenfaiq2
 
GR 12 IOT Week 2.pptx
GR 12 IOT Week 2.pptxGR 12 IOT Week 2.pptx
GR 12 IOT Week 2.pptx
afsheenfaiq2
 
IOT Week 20.pptx
IOT Week 20.pptxIOT Week 20.pptx
IOT Week 20.pptx
afsheenfaiq2
 
Lesson 17 - Pen Shade and Stamp.pptx
Lesson 17 - Pen Shade and Stamp.pptxLesson 17 - Pen Shade and Stamp.pptx
Lesson 17 - Pen Shade and Stamp.pptx
afsheenfaiq2
 
AP CS PD 1.3 Week 4.pptx
AP CS PD 1.3 Week 4.pptxAP CS PD 1.3 Week 4.pptx
AP CS PD 1.3 Week 4.pptx
afsheenfaiq2
 
2D Polygons using Pen tools- Week 21.pptx
2D Polygons using Pen tools- Week 21.pptx2D Polygons using Pen tools- Week 21.pptx
2D Polygons using Pen tools- Week 21.pptx
afsheenfaiq2
 
Chapter 11 Strings.pptx
Chapter 11 Strings.pptxChapter 11 Strings.pptx
Chapter 11 Strings.pptx
afsheenfaiq2
 
Lesson 10_Size Block.pptx
Lesson 10_Size Block.pptxLesson 10_Size Block.pptx
Lesson 10_Size Block.pptx
afsheenfaiq2
 
CH05.ppt
CH05.pptCH05.ppt
CH05.ppt
afsheenfaiq2
 
Chapter05.ppt
Chapter05.pptChapter05.ppt
Chapter05.ppt
afsheenfaiq2
 
Gr 12 - Buzzer Project on Sound Production (W10).pptx
Gr 12 - Buzzer Project on Sound Production (W10).pptxGr 12 - Buzzer Project on Sound Production (W10).pptx
Gr 12 - Buzzer Project on Sound Production (W10).pptx
afsheenfaiq2
 
Network Topologies
Network TopologiesNetwork Topologies
Network Topologies
afsheenfaiq2
 
IoT-Week1-Day1-Lecture.pptx
IoT-Week1-Day1-Lecture.pptxIoT-Week1-Day1-Lecture.pptx
IoT-Week1-Day1-Lecture.pptx
afsheenfaiq2
 
IoT-Week1-Day1-Lab.pptx
IoT-Week1-Day1-Lab.pptxIoT-Week1-Day1-Lab.pptx
IoT-Week1-Day1-Lab.pptx
afsheenfaiq2
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
afsheenfaiq2
 
object oriented porgramming using Java programming
object oriented porgramming using Java programmingobject oriented porgramming using Java programming
object oriented porgramming using Java programming
afsheenfaiq2
 
Object oriented programming design and implementation
Object oriented programming design and implementationObject oriented programming design and implementation
Object oriented programming design and implementation
afsheenfaiq2
 
Anime Display for Weekly Passion Hour Club
Anime Display for Weekly Passion Hour ClubAnime Display for Weekly Passion Hour Club
Anime Display for Weekly Passion Hour Club
afsheenfaiq2
 
Introduction to Declaring Functions in Python
Introduction to Declaring Functions in PythonIntroduction to Declaring Functions in Python
Introduction to Declaring Functions in Python
afsheenfaiq2
 
Sample Exam Questions on Python for revision
Sample Exam Questions on Python for revisionSample Exam Questions on Python for revision
Sample Exam Questions on Python for revision
afsheenfaiq2
 
GR 12 IOT Week 2.pptx
GR 12 IOT Week 2.pptxGR 12 IOT Week 2.pptx
GR 12 IOT Week 2.pptx
afsheenfaiq2
 
Lesson 17 - Pen Shade and Stamp.pptx
Lesson 17 - Pen Shade and Stamp.pptxLesson 17 - Pen Shade and Stamp.pptx
Lesson 17 - Pen Shade and Stamp.pptx
afsheenfaiq2
 
AP CS PD 1.3 Week 4.pptx
AP CS PD 1.3 Week 4.pptxAP CS PD 1.3 Week 4.pptx
AP CS PD 1.3 Week 4.pptx
afsheenfaiq2
 
2D Polygons using Pen tools- Week 21.pptx
2D Polygons using Pen tools- Week 21.pptx2D Polygons using Pen tools- Week 21.pptx
2D Polygons using Pen tools- Week 21.pptx
afsheenfaiq2
 
Chapter 11 Strings.pptx
Chapter 11 Strings.pptxChapter 11 Strings.pptx
Chapter 11 Strings.pptx
afsheenfaiq2
 
Lesson 10_Size Block.pptx
Lesson 10_Size Block.pptxLesson 10_Size Block.pptx
Lesson 10_Size Block.pptx
afsheenfaiq2
 
Gr 12 - Buzzer Project on Sound Production (W10).pptx
Gr 12 - Buzzer Project on Sound Production (W10).pptxGr 12 - Buzzer Project on Sound Production (W10).pptx
Gr 12 - Buzzer Project on Sound Production (W10).pptx
afsheenfaiq2
 
Network Topologies
Network TopologiesNetwork Topologies
Network Topologies
afsheenfaiq2
 
IoT-Week1-Day1-Lecture.pptx
IoT-Week1-Day1-Lecture.pptxIoT-Week1-Day1-Lecture.pptx
IoT-Week1-Day1-Lecture.pptx
afsheenfaiq2
 
IoT-Week1-Day1-Lab.pptx
IoT-Week1-Day1-Lab.pptxIoT-Week1-Day1-Lab.pptx
IoT-Week1-Day1-Lab.pptx
afsheenfaiq2
 
Ad

Recently uploaded (20)

EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdfFEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
LDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad UpdatesLDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad Updates
LDM & Mia eStudios
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independenceParenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
What are the benefits that dance brings?
What are the benefits that dance brings?What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle SchoolExploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
Quiz Club of PSG College of Arts & Science
 
Respiratory System , Urinary System
Respiratory  System , Urinary SystemRespiratory  System , Urinary System
Respiratory System , Urinary System
RushiMandali
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdfFEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
LDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad UpdatesLDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad Updates
LDM & Mia eStudios
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independenceParenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
What are the benefits that dance brings?
What are the benefits that dance brings?What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle SchoolExploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
Respiratory System , Urinary System
Respiratory  System , Urinary SystemRespiratory  System , Urinary System
Respiratory System , Urinary System
RushiMandali
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Ad

Creating Python Variables using Replit software

  • 1. Resources created by Andy Colley (@MrAColley) Learning Goals/Objectives Be able to read, comprehend, trace, adapt and create Python code that: • Performs simple maths (addition, subtraction, multiplication, division and integer division) using fixed numbers • Performs simple maths using numbers stored in variables • Converts strings to integers • Gets number input and uses it in calculations
  • 2. Resources created by Andy Colley (@MrAColley) Maths - Operators 2 + 2
  • 3. Resources created by Andy Colley (@MrAColley) Maths - Operators + addition - subtraction * multiplication / division (with decimal) // division (integer result)
  • 4. Resources created by Andy Colley (@MrAColley) Input Data is collected and sent to the computer Process Carrying out instructions. Output Presenting the results of processing back to the user Storage Saving data that is not in use.
  • 5. Resources created by Andy Colley (@MrAColley) Programming – Operators - Predict & Run https://repl.it/@MrAColley/21-Maths-part-1
  • 6. Resources created by Andy Colley (@MrAColley) Maths With Variables num1 = 5 num2 = 10 result = num1 + num2 print(result) Assign numbers to your variables. Perform the calculation. Assign the result to a NEW VARIABLE. Don’t forget to output the result
  • 7. Resources created by Andy Colley (@MrAColley) Variables - vary - changing data favColour “blue”
  • 8. Resources created by Andy Colley (@MrAColley) Programming – Variable Maths – Modify & Make score = 0 print(score) score = 10 print(score)
  • 9. Resources created by Andy Colley (@MrAColley) Changing Variables With Maths score = 0 print(score) score = 10 print(score) score = 0 print(score) score = score + 1 print(score) score = 0 print(score) score += 1 print(score) lives -= 1
  • 10. Resources created by Andy Colley (@MrAColley) Programming – Input & Variables - Integers Input works with strings. Strings are text. Computers can’t do maths/logic with text. They have to use numbers. Whole numbers are called integers (ints for short). We have to write code to convert our string input to an int before we can do maths with it.
  • 11. Resources created by Andy Colley (@MrAColley) Programming – Input & Variables - Integers num1 = int(input("Enter a number")) Tells the computer to convert to an integer. Tells the computer to convert to an integer. BRACKETS! Because syntax!
  • 12. Resources created by Andy Colley (@MrAColley) Programming – Input & Variables - Integers print(str(num1) Tells the computer to convert an integer variable to a string
  • 13. Resources created by Andy Colley (@MrAColley) Task 5 - Homework Challenge - Area Calc Create a program that allows the user to enter 2 numbers representing the width and length of a rectangle. The program calculates and displays the area of the rectangle. Example solution - https://repl.it/@MrAColley/25ChallengeExampleSolution
  • 14. Resources created by Andy Colley (@MrAColley) Extra Credit Challenges Perimeter Calc Create a program that allows the user to enter 2 numbers representing the width and length of a rectangle. The program calculates and displays the perimeter of the rectangle. Restaurant Tip Calculator Create a program that allows the user to enter the price of a meal at a restaurant. The program calculates the amount of the tip to be paid at 20%. The tip and total price are then displayed separately. Volume and Surface Calc Create a program that allows the user to enter 3 numbers representing the height, width and length of a cuboid. The program calculates and displays the volume and total surface area of the cuboid.