Introduction to Python
Overview
• What is Python
• History of Python
• Why learn Python
• Applications
• How to install Python
• Identifiers
• Fundamentals of Python
• Decision Making in Python
• Summary
What is Python?
• Python is a popular high-level,
interpreted programming language
• Created by Guido van Rossum in 1991
History of Python
• Invented in the Netherlands, early 90s by
Guido van Rossum
• Named after Monty Python
• Open sourced from the beginning
• Considered a scripting language, but is much
more
• Scalable, object oriented and functional from
the beginning
• Used by Google from the beginning
• Increasingly popular
Python’s Benevolent Dictator For
Life
• “Python is an experiment
in how much freedom
programmers need. Too
much freedom and
nobody can read
another's code; too little
and expressive-ness is
endangered.”
• - Guido van Rossum
Why Python
Why Learn Python?
• Easy to Learn – Simple syntax like English.
• Simplicity and readability
• Platform Independent
• Free and Open source
• Powerful & Versatile – Used in many industries.
• Rich Library Support – Pre-written code for AI, gaming,
etc.
• Embedded and Extensible
• High Demand – Many companies use Python
Application Areas
Applications of Python
• Web development
• Game development
• Machine learning
• Mathematics
• Education: superb lang for teaching programming
• Desktop GUI
• Software development
• Operating System
• AI
• IoT
Where is Python Used?
Python is used in various fields:
✅ Web Development – Django, Flask
✅ Data Science & AI – Machine Learning, Pandas
✅ Cybersecurity – Hacking, Security Tools
✅ Game Development – Pygame
✅ Automation – Auto email sending, Web
scraping
Installing Python
• Go to python.org
• Download the latest version
• Install and open IDLE or VS Code
Writing Your First Python Program
• print("Hello, Welcome to Python World!")
Enough to Understand the Code
• Indentation matters to code meaning
– Block structure indicated by indentation
• First assignment to a variable creates it
– Variable types don’t need to be declared.
– Python figures out the variable types on its own.
• Assignment is = and comparison is ==
• For numbers + - * / % are as expected
– Special use of + for string concatenation and % for
string formatting (as in C’s printf)
• Logical operators are words (and, or, not) not symbols
• The basic printing command is print
Identifiers
• A Python identifier is a name used to
identify a variable, function, class, module
or other object
Rules for Naming Identifiers
• Identifiers can be a combination of letters
in lowercase(a to z) or upercase (A to Z) or
digits(0-9) or an _ like var_1,myClass
• An identifier cannot start with a digit.
1variable is invalid but variable1 is valid
name
• Keywords cannot be used as identifiers
• We cannot use special symbols like £$%&
• Can be of any length
Keywords(reserved)
Fundamentals of Python
Variables
• Label for a location in memory
• store data
• Assignment operator (=) is used to assign
a value to a variable
• Example:
name = "Amna“
age = 13
height = 5.5
Data Types in Python
• classifying a value and determining what
operations can be performed on it
• Integer: numeric value
z = 5 / 2 # Answer 2, integer division
• Float: decimal
x = 3.456
• String: sequence of char surrounded by
quotes print (“hello”)
• Boolean: true/false
Question
Data Types
Input/Output
• Input functions (input()) allow users of a
program to place values into programming
code.
• Print functions (print()) allow programs to
output strings to users on a given
interface.
Taking User Input
• name = input("What is your name? ")
print("Hello, " + name + "!")
Decision Making (if-else Statements)
• If-else allow programmers to adapt the function of their
code based on a given condition.
• If a given condition (i.e. x % 2 == 0) is true, then the
statements following the if statement (if) will be executed
• If the condition is false, the statements following the else
statement (else) will be executed
Loops in Python (for & while)
• Example of a For Loop:
– for i in range(5):
– print("Hello, Python!")
While loop Example
Career Opportunities with Python
• Fields Python Can Lead To:
💻 Software Developer
📊Data Scientist
🕵Cyber security Analyst
🎮 Game Developer
Summary Points
•
✔ Python is easy to learn and used in many
fields.
✔ Variables, loops, and if-else statements help
in coding.
✔ Python can make games, automation tools,
AI models, and more!
Quick Quiz
• Python was created by?
a) Bill Gates
b) Guido van Rossum
c) Elon Musk
• What does print() do in Python?
a) Creates a variable
b) Displays text
c) Takes user input