Lesson1
Introductio
n to Python
Learning Intention:
• Learn how to write a Python program that prints
sentences, numbers, and equations.
Success Criteria:
• All: Print a sentence.
• Most: Print sentences, numbers, and equations.
• Some: Print complex equations and mix text with
results.
Algorithms:
• An algorithm is a set of instructions, expressed
in some sort of language.
• Understanding the language is necessary in order
to execute the instructions.
Why Choose
Python?
Python is widely used in various
fields such as:
• Web Development.
• Artificial intelligence.
• PISA Exam:
• Program for International Student Assessment (PISA): It is an
international assessment of the skills and knowledge from grade 7
to grade 12.
Syntax
Syntax in programming is the set of rules that define how code must be written so the
computer can understand it.
It’s like grammar in a language: just as sentences need correct spelling and
punctuation, programs need correct syntax.
• All programming languages have rules for syntax.
• Programs written in a programming language must
follow its syntax.
• Programs with syntax errors cannot be translated and
executed.
Your first steps in Python:
• Open the website:
[Link]
Functions:
A function in Python is a reusable block of code that performs a
specific task.
•It helps organize programs into smaller, manageable parts.
•You can use built-in functions (like print() or len()) or create your
own.
•Functions can take input (called parameters) and can give back
an output (called a return value).
Rules for functions
• No capital letters
• Blue
• It followed with parenthesis
The print Function
• What does the print() function do?
Activity1: text output
• Use the print () function to display three facts about
yourself.
Activity2: arithmetic equations
• Use the print() function to display one random
number and four arithmetic equations.
Question:
• What is the output of the following lines:
Critical Thinking
• Use print() function and combine text output
with arithmetic equation
Answer:
• The comma let's you add multiple arguments to
the print statement.
Reflection:
Find the syntax error in each program: