
Variables in Python
Presentation
•
Computers
•
8th Grade
•
Practice Problem
•
Hard
Khawla Hijazi
Used 35+ times
FREE Resource
9 Slides • 4 Questions
1
Variables In Python
2
Definition and Usage
The input() function allows user input.
For Example:
If you need to ask the user a question and you expect the user to enter a value.
Like
what is you name?
Or
What is your age?
Or
Enter your birthdate
3
Syntax
Input (prompt)
4
Input(prompt)
Syntax
5
Example
Write a python program to ask the user about their favorite Drink then print the answer “ My favorite drink is …………”
First:
Declare a variable to store the answer inside it
Drink=input(“what is your favorite drink?”)
Write the print command to print the answer
Print(“My favorite drink is “+ Drink)
6
Multiple Choice
Which of the following statements are correct?
Variables varies depending on the circumstances
Variables cannot be changed
Variables can be changed
7
colour=“brown ”
animal=“dog”
print(colour+animal)
Example:
A variable is created the moment you first assign a value to it.
How to declare a variable in Python
8
Single or Double Quotes?
String variables can be declared either by using single or double quotes:
Example:
Student_name="Ahmad"
or
Student_name='Ahmad'
9
Variable Names
A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). Rules for Python variables:
A variable name must start with a letter or the underscore character
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
Variable names are case-sensitive (age, Age and AGE are three different variables)
A variable name cannot be any of the Python keywords.
10
Multiple Select
Choose the correct variable name:
First Student
FirstStudent
1Student
First_Student
11
Multiple Choice
Is variable name CarName is the same as carname?
True
False
12
Fill in the Blanks
13
Use variable practice
Write a pythoin programe using variables to print Welcome yourname :
1. declare the variable
Name="khawla"
2. write the print sentence:
print("welcome " + Name)
The + is used for concatenation ( to combine strings together)
Variables In Python
Show answer
Auto Play
Slide 1 / 13
SLIDE
Similar Resources on Wayground
11 questions
Python Conditionals: Unlocking the Power of Decision-Making
Presentation
•
8th Grade
12 questions
x- and y-intercepts
Presentation
•
8th Grade
12 questions
Tello drone conditional
Presentation
•
8th Grade
12 questions
Scatterplots & Linear Regression
Presentation
•
8th - 9th Grade
11 questions
Possessive adjectives
Presentation
•
9th Grade
11 questions
Naming acids
Presentation
•
9th Grade
9 questions
Artistic Effects (Python with Tracy)
Presentation
•
8th Grade
12 questions
G7.Từ khoá cơ bản trong Excel
Presentation
•
7th Grade
Popular Resources on Wayground
20 questions
"What is the question asking??" Grades 3-5
Quiz
•
1st - 5th Grade
20 questions
“What is the question asking??” Grades 6-8
Quiz
•
6th - 8th Grade
10 questions
Fire Safety Quiz
Quiz
•
12th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
34 questions
STAAR Review 6th - 8th grade Reading Part 1
Quiz
•
6th - 8th Grade
20 questions
“What is the question asking??” English I-II
Quiz
•
9th - 12th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
47 questions
8th Grade Reading STAAR Ultimate Review!
Quiz
•
8th Grade
Discover more resources for Computers
20 questions
“What is the question asking??” Grades 6-8
Quiz
•
6th - 8th Grade
34 questions
STAAR Review 6th - 8th grade Reading Part 1
Quiz
•
6th - 8th Grade
47 questions
8th Grade Reading STAAR Ultimate Review!
Quiz
•
8th Grade
44 questions
8th Grade Social Studies - Staar Review 2021
Quiz
•
8th Grade
20 questions
8th Grade Science STAAR Review
Quiz
•
8th Grade
8 questions
Amoeba Sister Asexual vs Sexual Reproduction
Interactive video
•
8th Grade
15 questions
Pythagorean Theorem Word Problems Quizizz
Quiz
•
8th Grade
29 questions
8th Grade Social Studies STAAR Review Part 2
Quiz
•
8th Grade