
Procedural Programming: 01 Python Basics
Presentation
•
Computers
•
University
•
Practice Problem
•
Medium
Karen Ahmed
Used 23+ times
FREE Resource
12 Slides • 9 Questions
1
Procedural Programming: Lesson 1 Part 2
Python Basics
2
Statements & Expressions
Python is an interpreted high-level programming language.
A complete computer command is called a statement.
For example: print("Hello World")
An expression evaluates to a new value.
For example: 2*2
3
Multiple Choice
What is a statement?
A section of an algorithm
A translation of machine code
A precise description of a problem
A complete computer command
4
Multiple Choice
Which function outputs text to the terminal?
output()
print()
write()
type()
5
Variables
We can store values in variables.
To do this we use the assignment operator =
For example: answer = 2*2
Variables store values not expressions
Good variable names describe the data they contain
6
Multiple Choice
How do we assign the number 10 to a variable?
new variable_name = 10
variable_name == 10
def variable_name = 10
variable_name = 10
7
Multiple Choice
What is the output of this code?
cool_number
210
42
8
Data Types
All variables have a data type
ints are whole numbers
floats are decimal numbers
strings are text
Variables can be of any data type
In Python, we don't need to declare variables, we can just use them by assigning a value
For example:
9
Multiple Choice
Which of these variables is a string?
cool_variable_1
cool_variable_2
cool_variable_3
cool_variable_4
10
Multiple Choice
What is the difference between a float and an int?
A float is text, int is a number
A float is decimal, int is a whole number
A float is a whole number an int is decimal
11
Strings
We can define strings on multiple lines
We can combine string values to make a new string.
Strings are combined using the + operator.
This is called string concatenation.
Strings are concatenated without spaces.
12
Multiple Choice
How do we define a multi-line string?
###
Like this
###
***
Like this
***
"""
Like this
"""
13
Multiple Choice
How do you combine two strings?
string1 + string2
string1.combine(string2)
string1.concatenate(string2)
14
Comments
We use comments to explain our code.
Comments are ignored by programming languages.
A comment in Python begins with the # character
For example: #this is a comment
15
Multiple Choice
What character begins a comment in Python?
%
*
#
/
16

ascii-art - Replit
You can open this webpage in a new tab.
17
Lovely Loveseat Project
18

LovelyLoveseats - Replit
You can open this webpage in a new tab.
19
User Input
We can also use variables to store user input.
We use input() to assign a user value to a variable.
This requires a prompt message for the user.
This is printed before they can enter data.
For example:
20
Working with Strings & Ints
Python always accepts user input as a string.
So we cannot perform calculations with it.
We need to convert the input string to an int using the int() function
For example:
21

TheCalculator - Replit
You can open this webpage in a new tab.
Procedural Programming: Lesson 1 Part 2
Python Basics
Show answer
Auto Play
Slide 1 / 21
SLIDE
Similar Resources on Wayground
17 questions
saving and investing
Presentation
•
University
15 questions
HALLOWEEN reading comprehension
Presentation
•
University
16 questions
Problem-solving
Presentation
•
University
17 questions
Ecuaciones No Lineales
Presentation
•
University
17 questions
MATERI TIK KELAS X
Presentation
•
KG - University
17 questions
Safe, Responsible and Ethical Use of ICT
Presentation
•
University
20 questions
Ejercicios en EXCEL
Presentation
•
University
17 questions
Comparatives and superlatives
Presentation
•
University
Popular Resources on Wayground
6 questions
Secondary Safety Quiz
Presentation
•
9th - 12th Grade
10 questions
MyPath Diagnostic Overview
Presentation
•
6th - 8th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Adding and Subtracting Decimals
Quiz
•
5th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
21 questions
Lab Safety
Quiz
•
10th Grade
Discover more resources for Computers
20 questions
Disney Trivia
Quiz
•
University
20 questions
Brand Trivia
Quiz
•
9th Grade - University
10 questions
Would you rather...
Quiz
•
KG - University
21 questions
Mapa países hispanohablantes
Quiz
•
1st Grade - University
10 questions
Spanish Greetings and Goodbyes!
Presentation
•
6th Grade - University
12 questions
CE 2b Early Documents Review
Quiz
•
7th Grade - University
30 questions
Multiplying and Dividing Integers
Quiz
•
6th Grade - University
13 questions
Back to School
Quiz
•
KG - University