0% found this document useful (0 votes)
28 views7 pages

Introduction to Python Programming

Python is a high-level, interpreted programming language created by Guido van Rossum in 1991, known for its simple syntax and versatility across various applications like web development and data science. It features easy learning, extensive libraries, and a supportive community, but is slower than C/C++ and not ideal for mobile app development. The document also covers setting up the Python environment, using IDLE and Jupyter Notebook, and introduces variables and data types with examples.

Uploaded by

ashokbose9025
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views7 pages

Introduction to Python Programming

Python is a high-level, interpreted programming language created by Guido van Rossum in 1991, known for its simple syntax and versatility across various applications like web development and data science. It features easy learning, extensive libraries, and a supportive community, but is slower than C/C++ and not ideal for mobile app development. The document also covers setting up the Python environment, using IDLE and Jupyter Notebook, and introduces variables and data types with examples.

Uploaded by

ashokbose9025
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Overview of Python Programming Language

What is Python?
Python is a high-level, interpreted, general-purpose programming language.
It is known for its simple syntax, which makes it easy to learn and use.

History
 Created by Guido van Rossum.
 First released in 1991.
 The name "Python" comes from the British comedy show "Monty Python’s Flying
Circus" – not the snake!

Key Features of Python

Feature Description

Easy to Learn Simple and clean syntax

Interpreted Code runs line-by-line, no need to compile

Cross-platform Works on Windows, macOS, Linux

Free and Open Source Anyone can use and contribute

Object-Oriented Supports classes and objects

Extensive Libraries Many built-in and third-party modules (like NumPy, Pandas)

Dynamically Typed No need to declare variable types

Where is Python Used?


 Web Development – Django, Flask
 Data Science & Machine Learning – NumPy, Pandas, Scikit-learn
 Artificial Intelligence – TensorFlow, PyTorch
 Desktop Applications – Tkinter, PyQt
 Automation/Scripting – Automate daily tasks
 Game Development – Pygame
 Networking & IoT
 Education – Used in schools and colleges to teach programming

Advantages
 Beginner-friendly
 Huge community support
 Code readability
 Scalable and versatile

Disadvantages
 Slower than C/C++ (because it's interpreted)
 Not ideal for mobile app development

Setting Up Python Environment


Step 1: Install Python
 Go to: [Link]
 Click “Download Python 3.x”
 Run the installer and check the box “ Add Python to PATH”
 Click “Install Now”
Done! Python is now install

Using IDLE (Integrated Development and Learning Environment)


What is IDLE?
IDLE is the default Python editor that comes with Python installation.

How to Open IDLE:


 Windows: Search "IDLE" in the Start Menu

Features:
 Built-in text editor and shell
 Write, save, and run Python code
 Good for beginners

2. Using Jupyter Notebook


What is Jupyter Notebook?
Jupyter Notebook is a web-based interactive environment. You can:
 Write and run code in cells
 Add notes with Markdown
 Visualize data using graphs

Ideal for:
 Data science
 Machine learning
 Teaching & learning

How to Install Jupyter Notebook:


Option 1: Install via Anaconda (Recommended for beginners)
1. Download from: [Link]
2. Install and open Anaconda Navigator
3. Click Launch on Jupyter Notebook

Option 2: Install using pip

pip install notebook


To start Jupyter:

jupyter notebook
IDLE vs Jupyter Notebook
Feature IDLE Jupyter Notebook

Interface Basic Web-based

Code Style Script-based Cell-based

Best For Beginners Data science, visualization

Markdown Support ❌ No ✅ Yes

Output Basic Rich (Graphs, Tables, Images)

Variables and Data Types in Python


What is a Variable?
A variable is a name that stores a value.
It acts like a container to hold data in memory.

Real-life example:
Think of a school bag holding books.

Rules for Naming Variables


 Must start with a letter (a-z, A-Z) or underscore (_)
 Cannot start with a number
 No spaces or special characters
 Case-sensitive (age ≠ Age)
Valid: name, age1, _score
Invalid: 1age, my name, @value

Python Variable Examples:


3edcxx1: Storing Student Details
name = "Akila"
age = 23
grade = 'A'
passed = True
Examples
[Link] Shop
[Link] Details
[Link] of Subjects

Data Types in Python


What is a Data Type?
A data type tells what kind of data a variable can hold.

Basic Data Types in Python


Data Type Example Description
Int 5, -10 Whole numbers
Float 3.14, 0.5 Decimal numbers
Str "Hello", 'A' Text or characters
Bool True, False Boolean values (Yes/No, 1/0)
List [1, 2, 3] Ordered, changeable collection
Tuple (4, 5, 6) Ordered but unchangeable collection
Dict {"name": "Akila"} Key-value pair
Set {1, 2, 3} Unordered and unique items

Examples of Each Data Type


int → Integer

age = 25
marks = -10

float → Decimal
str → String
price = 99.99
weight = 2.5
name = "Akila"

grade = 'A'
bool → Boolean

is_passed = True

is_late = False

list → List
colors = ["red", "green", "blue"]

tuple → Tuple (unchangeable list)

months = ("Jan", "Feb", "Mar")


dict → Dictionary (key-value pair)

student = {"name": "Karthik", "age": 23}


set → Set (unique values, no duplicates)

numbers = {1, 2, 3, 3, 2}

print(numbers) # Output: {1, 2, 3}

Use type() to check Data Type

x = "Hello"

print(type(x)) # Output: <class 'str'>

Practice Tasks
1: Identify the Data Type
a = 10
b = 3.14
c = "Python"
d = True
e = [1, 2, 3]
f = (4, 5, 6)
g = {"name": "Akila", "age": 23}, h = {1, 2, 2, 3}
Task 2: Match the Following
Value Data Type
"Hello" A. list
Value Data Type

42 B. str
[1, 2, 3] C. dict
(10, 20) D. set
{"x": 10, "y": 20} E. int
{5, 6, 7} F. tuple
Task 3: Find the Mistake

x = [1, 2, 3
y = {"name" = "Karthik"}
z = (4, 5, 6)
print(x + y)

Task 4: Your Own Data


Ask students to create variables for their:
 Name (string)
 Age (int)
 Marks (float)
 Subjects (list)
 Address (dictionary)

You might also like