
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
20 questions
CN 5
Presentation
•
University
18 questions
Computing Facts & Knowledge
Presentation
•
University
16 questions
Zephyrus G14 Alan Walker
Presentation
•
University
16 questions
Fundamentos de la planeación
Presentation
•
University
16 questions
Subject, object, possessive pronouns & possesive adjectives
Presentation
•
University
16 questions
HOSPITALITY AND INFORMATION SYSTEM
Presentation
•
University
16 questions
Soccer Ball game scratch 1
Presentation
•
University
15 questions
Perkembangan Teknologi
Presentation
•
University
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
20 questions
Guess The App
Quiz
•
KG - Professional Dev...
11 questions
NFL Football logos
Quiz
•
KG - Professional Dev...
19 questions
Minecraft
Quiz
•
6th Grade - Professio...
40 questions
8th Grade Math Review
Quiz
•
8th Grade - University
20 questions
Block Buster Movies
Quiz
•
10th Grade - Professi...
10 questions
Would you rather...
Quiz
•
KG - University
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...
14 questions
Superhero
Quiz
•
1st Grade - University