Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

L1 Introduction To Programming

Uploaded by

Zebin Haira
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

L1 Introduction To Programming

Uploaded by

Zebin Haira
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Python

Programming
Learning objective

 To define programs and variables.


 Understand how to use the print() function to display output.
 Learn how to use the input() function to accept user input.
 Understand what variables are and how to use them to store and manipulate data in
Python.
Starter
• What is a program?
• Have you heard about programming languages? Can you name them?
Programs

• A program is a set of precise


instructions, expressed in a
programming language.
• Translating the programming
language is necessary for a
machine to be able to execute
the instructions.
What is Python?
• Python is a high-level, general-purpose, and very popular
programming language.
• Invented in the Netherlands, early 90s by Guido van
Rossum
• Python programming language (latest Python 3) is being
used in web development, and Machine Learning
applications, along with all cutting-edge technology in
Software Industry.
• Python language is being used by almost all tech-giant
companies like – Google, Amazon, Facebook, Instagram,
Dropbox, Uber, etc.
Syntax
• All programming languages have rules for syntax, i.e.
how statements can be assembled.
• Programs written in a programming language must
follow its syntax.
• Programs with syntax errors cannot be translated and
executed.
We will be using Online Python
compiler to test and execute our
programs
• https://www.onlinegdb.com/online_python_compiler
Variables
1. Python variables are simply containers for storing
data values.
2. A variable is a placeholder for information you want
Python to recall later in the coding process when
you need to complete an action.
3. The value stored in a variable can be changed
during program execution
Key points about variables in Python:
•Variable names:
•Must start with a letter (a-z, A-Z) or an underscore (_).
•Can contain letters, numbers, and underscores.
•Are case-sensitive (e.g., age and Age are different variables).
•No spaces(e.g num1 or num_1)

Assigning values: You assign a value to a variable using the assignment operator(=).
Variables
Assessment For Learning
Locate the fragment(s) of code
Line1:print("Best Subject Ever?")
that:
Line2:subject = “Computer Science” ● Display a message for the
Line3:print(subject, "is my favourite too!") user on the screen
● Assign a value to a variable.
● Identify a variable.
● Identify a value
Print() Function
Python print() function prints the message to the screen or any
other standard output.
Input() function
• The input () is a built-in function in python that allows the user to enter data which the program can use.
• The user must enter the input when the prompt message pops on the screen with the help of the keyboard.
• Once the input is given, this is evaluated, and the output is displayed.
Arithmetic operators in python
Activity 1- (Pair Programming)

Level 1- Python Print() Level 2- Create a conversation style Extension Task


Function program using both print and input Level 3- Create a Simple calculator using arithmetic
function. operators

Open Python Your program must ask at least three Write a python program that takes two variables and
environments and try: questions (name, age, and favorite assign random values to it.(Ex -Num1=20, Num2 = 10).
•Printing your name. hobby), then print a sentence Your program must find the total, difference, product and
•Print the year you summarizing the information: division of the two numbers and print the required result.
were born. For example, If two numbers are 20 and 10, the sum of
•Print your favorite Example: “[name] is [age] years old two numbers is 30, the difference of two numbers is 10,
color. and enjoys [hobby]”. the product of two numbers is 200, etc.
Level 1 -
Level 2 - Answer
Answer
Program Program

Output Output
Extension Task – Level 3 Answer

Program Output
Assessment For learning
Join Kahoot

• https://create.kahoot.it/share/p
ython-basics-print-input-variable
s-syntax/bd6ffed8-8d8c-445d-be
70-bb2fb51b811c
Plenary
A quick summary of the lesson
through
• https://wordwall.net/resource/22690224/python-quiz-concepts-revisi
ted
Reflect/Review your learning
Success Criteria Yes, I can I need help
I can use the print() function to
display a message on screen

I can use the input() function to


retrieve the input from the
user/keyboard
I can explain what a variable is
I can create variables and assign
value to it
I can create a python programming
by incorporating print and input
function.

You might also like