Data Structure Using Python (313306)
Campusify Notes
These notes are prepared according to the MSBTE K-Scheme syllabus. They cover Unit 1 in a
simple, exam-oriented format.
Unit 1 – Introduction and Control Flow Statements in Python
1.1 Features of Python
Definition:
Python is a high-level, interpreted, object-oriented programming
language that is easy to learn and widely used.
Features:
• Interactive – execute code line by line.
• Object-Oriented – supports classes and objects.
• Interpreted – no compilation required.
• Platform Independent – runs on Windows, Linux and macOS.
• Simple Syntax – easy to read and write.
• Open Source – free to use.
• Large Library Support – many built-in modules.
Real-life Example:
Python is used in AI, web development, automation, data science and
cybersecurity.
Example:
print("Hello Campusify")
Output:
Hello Campusify
Advantages:
• Easy to learn
• Less coding
• Large community support
1.2 Python Building Blocks
Identifiers: Names given to variables, functions and classes.
Keywords: Reserved words like if, else, for, while, True, False.
Variables: Store data values.
Comments:
# Single-line comment
'''Multi-line comment'''
Example:
age = 19
name = "Prathmesh"
1.3 Python Data Types
Common Data Types:
int, float, complex, bool, str, list, tuple, set, dict
Example:
x = 10
name = "Python"
marks = [80, 90]
1.4 Operators
Arithmetic: + - * / // % **
Comparison: == != > < >= <=
Logical: and or not
Assignment: = += -=
Membership: in, not in
Identity: is, is not
Bitwise: &, |, ^, ~, <<, >>
Operator precedence determines the order in which operators are
evaluated.
1.5 Control Flow Statements
Conditional Statements:
if, if-else, nested if
Loops:
while
for
nested loops
Loop Control:
break – terminates loop
continue – skips current iteration
pass – placeholder
else – executes when loop finishes normally
Example:
for i in range(1,6):
print(i)