0% found this document useful (0 votes)
0 views5 pages

1.Introduction to Python

The document provides an introduction to Python, highlighting its creation by Guido van Rossum in 1991 and its applications in various fields such as web development and data science. It outlines key features like readability, dynamic typing, and support for multiple programming paradigms, as well as basic syntax and data types including numeric, string, list, tuple, dictionary, and set. Additionally, it includes practice questions to reinforce understanding of Python concepts.

Uploaded by

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

1.Introduction to Python

The document provides an introduction to Python, highlighting its creation by Guido van Rossum in 1991 and its applications in various fields such as web development and data science. It outlines key features like readability, dynamic typing, and support for multiple programming paradigms, as well as basic syntax and data types including numeric, string, list, tuple, dictionary, and set. Additionally, it includes practice questions to reinforce understanding of Python concepts.

Uploaded by

deepamrit65
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

Introduction to Python
· Python is a high-level, interpreted programming language created by Guido van Rossum in
1991.

· It emphasizes code readability and simplicity, making it ideal for beginners.


· Python is widely used in web development, data science, automation, AI, and more.

Python's Versatile Applications

Beginner-Friendly

Ideal for learning programming

Development Domains

Web, data science, automation, AI

Core Principles

High-level, interpreted, readable code

2. Features of Python:-

· Easy to read and write


· Interpreted language – no need to compile
· Dynamically typed – no need to declare variable types
· Large standard library
· Open-source and community-supported
· Supports multiple programming paradigms: procedural, object-oriented, functional
Key Features of Python

Multi-Paradigm
Support
Supports various programming
styles

Open-Source Readability
Free and community- Easy to understand and
supported 5 write

Large Standard Interpreted


Library 4 2 Language
Extensive built-in
No compilation needed
modules

Dynamic Typing
No need to declare variable
types

3. Python Syntax Basics:

· Python uses indentation to define blocks of code.


· Statements end with a new line, not a semicolon (;).
· Comments start with '#'.

4. Python Data Types:-

What is a Data Type?


A data type tells Python what kind of data a variable is storing — text, number, list,
etc.

For example:
name = "Abhishek" # Text → str
age = 25 # Number → int

5. Numeric Data Types:-

a. int (Integer)
• Whole numbers (positive or negative)
No decimal point

E.g:-
x = 10
y = -99

b. float (Floating-point)
• Numbers with decimals
• Useful in calculations
a= 3.14

c. complex
• Numbers with a real and imaginary part
• Used in advanced math (not common in beginner-level)

e.g:-
z = 2 + 3j

2. str (String) – Text Type:-


• A string is a sequence of characters (text).
• Enclosed in quotes: ' ', " ", or ''' '''.

e.g:- name = "Abhishek"


greeting = 'Hello'
sentence = '''This is a multi-line string.'''

Operations with strings:-

print(name.upper()) # ABHISHEK
print(name.lower()) # abhishek
print(name[0]) #A
print(name[1:4]) # bhi

3. bool (Boolean) – True/False


• Used in conditions and logic
• Only two values: True or False

e.g:-
is_raining = True
is_student = False
age = 20
print(age > 18) # True

4. Sequence Data Types

a. list
• Ordered
• Mutable (changeable)
• Can hold different types of values

e.g:-

fruits = ["apple", "banana", "cherry"]


print(fruits[1]) # banana
fruits[2] = "mango" # changes cherry to mango

b. tuple

• Ordered
• Immutable (cannot be changed)
• Faster than list

e.g:-
colors = ("red", "green", "blue")
print(colors[0]) # red

c. range

• Sequence of numbers
• Often used in loops

e.g:-
numbers = range(5) # 0 to 4
for i in numbers:
print(i)

5. Mapping Data Type:-

dict (Dictionary)
• Key-value pairs
• Like a mini-database

e.g:-
student = {
"name": "Rutuja",
"age": 21,
"marks": 85.5
}
print(student["name"]) # Rutuja

6. Set Data Types:-

a. set
• Unordered
• No duplicates

e.g:-
unique_numbers = {1, 2, 3, 2, 1}
print(unique_numbers) # {1, 2, 3}

Practice Questions:-
1. Create a list of your 3 favorite movies.
2. Make a dictionary for yourself with keys: name, age, city.
3. Check if 25 > 10 and print the boolean result.
4. Create a set with some duplicate numbers and print it.

You might also like