
Intro Python Y9
Presentation
•
Computers
•
9th Grade
•
Easy
Shaw Williams
Used 1+ times
FREE Resource
9 Slides • 6 Questions
1
Intro Python Y9
Mr. Williams
2
Examples of Variables
The following are examples of ACCEPTABLE variable names:
apples, car, costs
b8, a12, z1000
The following are example of NOT ACCEPTABLE variable names:
1, 100, 3000, 22, 14 (a variable can not start with a number)
print, input, def (these are keywords used within python)
3
Variables
Part of a program that can be assigned a specific value
Made up of two parts; an identifier, and a value.
This value CAN change while the program is running.
4
Constant
Part of a program that can be assigned a specific value
Made up of two parts; an identifier and a value.
This value can NOT change while the program is running.
5
Multiple Choice
What is the name of the 'Variable' in this example Python code
name
input
("What is your name")
6
Commenting your code
It's important to comment your code often.
When commenting code, use the symbol # followed by your comment
7
Multiple Select
Why is it important that we use comments in our code?
They help the program run smoothly
So that we understand what the line of code does
To help other programmers understand our code
To fill our code with colours
8
Variable names
Variable names are limited to certain characters when they are defined in your code. Using incorrect Variable names will result in your code displaying the error:
"Syntax Error: invalid syntax"
9
Multiple Select
Which of the following are acceptable Variable names
horse
x
3
x4
10
Variable Types
All data in Python is represented by 'objects' or the relationship between 'objects'.
Every object has three things:
An 'identity'
A 'type'
A 'Value'
An objects 'identity' never changes once it has been created - it is forever saved in the Python's memory.
11
Variable Types continued..
An object's type determines what operations that it supports, for example:
Does it have a length? which then defines the possible values for objects of that type.
The type() function returns an object's type (which is an object itself)
Just like an object's 'identity', an object's type is also unchangeable.
The values of some objects can change though...
12
Multiple Choice
Objects who value is unchangeable once they are created are called...
Immutable
Mutable
Defined
Undefined
13
Multiple Choice
When this Python code is run what will it display?
<class = 'int'>
<class = 'float'>
<class = 'int'>
<class = 'float'>
9
9.0
14
Type conversion
There are several built-in functions that let you convert one data type into another. These functions return a new object representing the converted value, such as:
int(x) which converts x into an integer
float(x) which converts x into a floating-point number
str(x) which converts x into a string representation
15
Multiple Choice
What would you type to covert the float number to an integer?
print(type(float_number)
print(float_number)
print(int(float_number)
print(number)
Intro Python Y9
Mr. Williams
Show answer
Auto Play
Slide 1 / 15
SLIDE
Similar Resources on Wayground
12 questions
4.1 Intro to Quadratic Functions
Presentation
•
8th - 10th Grade
12 questions
Review: Key Features of Quadratic Functions
Presentation
•
9th Grade
11 questions
7.2 Writing Exponential Functions
Presentation
•
9th Grade
10 questions
Introduction to Computer Hardware - Yr 9
Presentation
•
9th Grade
13 questions
Solve by Completing the Square Lesson
Presentation
•
9th Grade
8 questions
Консультация
Presentation
•
9th Grade
12 questions
How Many Solutions?
Presentation
•
8th - 10th Grade
12 questions
Graphing/Functions
Presentation
•
8th Grade
Popular Resources on Wayground
20 questions
Math Review
Quiz
•
3rd Grade
15 questions
Fast food
Quiz
•
7th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
19 questions
Classifying Quadrilaterals
Quiz
•
3rd Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
10 questions
Identify Fractions, Mixed Numbers & Improper Fractions
Quiz
•
3rd - 4th Grade
Discover more resources for Computers
10 questions
Fact Check Ice Breaker: Two truths and a lie
Quiz
•
5th - 12th Grade
10 questions
Video Games
Quiz
•
6th - 12th Grade
10 questions
Logos
Quiz
•
6th - 9th Grade
10 questions
Test Your Knowledge with 15 Fun Trivia Questions
Interactive video
•
6th - 10th Grade
15 questions
Memorial Day Trivia
Quiz
•
KG - 12th Grade
21 questions
Factoring Trinomials (a=1)
Quiz
•
9th Grade
12 questions
Name that Candy
Quiz
•
KG - 12th Grade
20 questions
Guess The App
Quiz
•
KG - Professional Dev...