1.
Introduction to Python Programming
Python is a high-level, interpreted and general-purpose programming language created by Guido
van Rossum in 1991. It is known for its simple syntax, readability and versatility. Python is widely
used in web development, data science, artificial intelligence, machine learning, and automation.
print("Hello, World!")
2. IPO Cycle in Python
IPO stands for Input, Processing and Output. It represents the working of a program.
a = int(input("Enter number: "))
b = int(input("Enter number: "))
sum = a + b
print("Sum =", sum)
3. Comments in Python
Comments are non-executable statements used to explain the code and improve readability.
# This is a single-line comment
4. Variables
Variables store data values. Python automatically assigns type based on value.
x = 10
name = 'Python'
5. Operators
Operators perform operations on variables.
print(10 + 5)
print(10 > 5)
6. Type Conversion
Type conversion converts one data type into another.
x = int('10')
y = float(5)
7. Conditional Statements
Used for decision making.
marks = 80
if marks >= 75:
print("Grade B")
8. Looping Statements
Loops execute code repeatedly.
for i in range(1,6):
print(i)
9. Lists
Lists are ordered and mutable collections.
numbers = [10,20,30]
10. Tuples
Tuples are ordered but immutable.
t = (1,2,3)
11. Strings
Strings are sequences of characters.
s = 'Python'
print(s[0:3])
12. Dictionaries
Dictionaries store key-value pairs.
student = {'name':'Ravi','age':20}
13. Sets
Sets are unordered collections without duplicates.
s = {1,2,3}
14. Functions
Functions are reusable blocks of code.
def add(a,b):
return a+b
15. File Handling
File handling allows storing and retrieving data.
f = open("[Link]","w")
[Link]("Hello")
[Link]()