
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
15 questions
Correo Electronico
Presentation
•
KG
17 questions
MICROSOFT POWERPOINT
Presentation
•
University
15 questions
Sistemas Operativos
Presentation
•
University
14 questions
Traffic Signs
Presentation
•
KG
14 questions
La libertad 1. Qué es la Ilustración
Presentation
•
KG
16 questions
Php basic
Presentation
•
University
17 questions
ejercicio
Presentation
•
University
15 questions
PSICOLOGIA
Presentation
•
University
Popular Resources on Wayground
24 questions
PBIS-HGMS Day 10
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Review 3
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
15 questions
HCS SCI 05 Summer School Assessment 3 Review
Quiz
•
5th Grade
35 questions
Lufkin Road Middle School Student Handbook & Policies Assessment
Quiz
•
7th Grade
18 questions
Geo 11.3 Area of Circles and Sectors
Quiz
•
9th - 11th Grade