0% found this document useful (0 votes)
19 views6 pages

Python Notes Units1to5

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)
19 views6 pages

Python Notes Units1to5

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/ 6

Python Programming – Full Notes

Units 1 to 5 – Comprehensive Notes for Exam Preparation


Unit 1 – Python Basics
What is Python? Mention its features.
Python is a high-level, interpreted, object-oriented programming language known for its simplicity and readability.
Features include: interpreted execution, dynamically typed, extensive libraries, cross-platform compatibility, and
support for multiple paradigms (procedural, object-oriented, functional).

What are identifiers in Python? What are the naming rules?


Identifiers are names given to variables, functions, classes, etc. Rules: must begin with a letter or underscore, can
contain letters, digits, underscores, case-sensitive, and cannot be a keyword.

Define variable. How are variables created in Python?


A variable is a named memory location that stores data. In Python, variables are created by assignment, e.g., x =
10. Type is inferred dynamically.
Unit 2 – Control Flow
What are Boolean values? What are logical operators in Python?
Boolean values are True and False. Logical operators are and, or, and not.

Explain if, if-else, and if-elif-else with examples.


if executes a block if condition is true. if-else executes one block if true, another if false. if-elif-else checks multiple
conditions sequentially.
Unit 3 – Functions, Arrays, Strings
What is a function? Why are functions needed?
A function is a reusable block of code designed to perform a specific task. Functions improve modularity,
reusability, and readability.

Explain scope of variables: local vs global.


Local variables are defined inside a function and accessible only there. Global variables are declared outside
functions and can be accessed throughout the program.
Unit 4 – Lists, Tuples, Dictionaries
What is a list? How is it created?
A list is an ordered, mutable collection of elements. Created using square brackets, e.g., numbers = [1, 2, 3].

What is a dictionary? How is it created?


A dictionary is an unordered collection of key-value pairs. Created using curly braces, e.g., student = {'name':
'Alice', 'age': 20}.
Unit 5 – OOP, Files, Exceptions
What is Object-Oriented Programming (OOP)?
OOP is a paradigm based on the concept of objects that contain data (attributes) and methods (functions). It
emphasizes reusability, modularity, and abstraction.

Explain the four main principles of OOP.


Encapsulation: hiding implementation details. Abstraction: showing essential features only. Inheritance: deriving
new classes from existing ones. Polymorphism: ability of methods to perform differently based on context.

You might also like