Basics of Python
Dr.Ginne M James
Sri Ramakrishna College of Arts & Science
Coimbatore
BASICS OF PYTHON PROGRAMMING
Introduction to Python
What is Python?
•High-level, interpreted, and general-purpose programming language.
•Known for its simplicity and readability.
•Creator:
•Developed by Guido van Rossum in 1991.
•Purpose:
•Designed for beginner-friendly programming and rapid application development.
BASICS OF PYTHON PROGRAMMING
History of Python
•1980s: Development began as a hobby project.
•1991: First official release of Python (Python 0.9.0).
•2000: Python 2.0 introduced features like list comprehensions and garbage collection.
•2008: Python 3.0 released, improving performance and syntax.
•Today:
•Widely used in web development, AI, data science, and automation.
•Large, active community and extensive library support.
BASICS OF PYTHON PROGRAMMING
Features of Python
•Simple and Easy to Learn: Syntax similar to English.
•Open Source: Free to use and distribute.
•Interpreted Language: No need for compilation.
•Platform-Independent: Code runs on any operating system.
•Extensive Libraries: Support for tasks like web development, data analysis, and AI.
•Dynamic Typing: No need to declare variable types.
•Supports Multiple Paradigms: Object-oriented, functional, and procedural programming.
BASICS OF PYTHON PROGRAMMING
Writing and Executing Your First
Python Program
Step 1: Install Python from python.org.
Step 2: Choose an IDE (e.g., IDLE, PyCharm, VS Code).
Step 3: Write your program
print("Hello, Python!")
Step 4: Save the file with .py extension.
Step 5: Run the program in the terminal or IDE.
BASICS OF PYTHON PROGRAMMING
Literal Constants
Definition: Fixed values assigned directly to variables.
•Types of Constants:
•Numeric: Integers (10), Floats (3.14), Complex (2+3j).
•String: 'Hello', "World".
•Boolean: True, False.
•age = 21 # Numeric constant
•name = "Alice" # String constant
BASICS OF PYTHON PROGRAMMING
Variables and Identifiers
•Variables: Named memory locations to store data.
•Example: x = 10
•Identifiers: Names used for variables, functions, and classes.
•Rules:
•Must begin with a letter or _.
•Can’t use Python keywords.
•_count = 5
•studentName = "John"
BASICS OF PYTHON PROGRAMMING