0% found this document useful (0 votes)
2 views3 pages

Python Notes Systematic

The document provides an overview of fundamental Python concepts, including data types, loops, file handling, and functions. It also covers object-oriented programming principles, recursion, exception handling, and various types of function arguments. Key distinctions between encapsulation and abstraction, as well as division operators, are highlighted.

Uploaded by

Nikita's world
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)
2 views3 pages

Python Notes Systematic

The document provides an overview of fundamental Python concepts, including data types, loops, file handling, and functions. It also covers object-oriented programming principles, recursion, exception handling, and various types of function arguments. Key distinctions between encapsulation and abstraction, as well as division operators, are highlighted.

Uploaded by

Nikita's world
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

SYSTEMATIC PYTHON NOTES

1. DATA TYPES BASICS

- String: Text data inside quotes (“Hello”)

- List: Ordered, changeable collection [1,2,3]

- Tuple: Ordered, unchangeable collection (1,2,3)

- Dictionary: Key–value pairs {"name": "John"}

2. FOR LOOP VS WHILE LOOP

- For loop: Repeats for fixed range/sequence

- While loop: Repeats until condition becomes false

3. FILE HANDLING

- r = read

- w = write

- a = append

- x = create

- with open(...) auto-closes file

4. CSV AND TEXT FILES

- .txt → plain text

- .csv → comma separated values (used for tables/datasets)

5. FUNCTIONS

• Built■in functions → print(), len(), sum()

• User■defined functions → created using def

6. RECURSION

A function that calls itself

Example:

def fact(n):
if n==1: return 1

return n * fact(n-1)

7. CONCATENATION

Joining strings:

"Hello " + "World"

8. OOP CONCEPTS

A. Class → blueprint to create objects

B. Inheritance → child class gets properties of parent

C. Encapsulation → hiding data inside class

D. Abstraction → showing only essential details

Difference:

Encapsulation = hides data using methods/variables

Abstraction = hides complexity, shows only necessary parts

9. DIVISION OPERATORS

- / → normal division (gives decimal)

- // → floor division (whole number)

10. EXCEPTION HANDLING

try:

code

except:

handles error

else:

runs if no error

finally:

runs always

11. PASS STATEMENT


A null statement that does nothing (placeholder)

12. FUNCTION ARGUMENTS

- Positional arguments

- Keyword arguments

- Default arguments

- *args → many values

- **kwargs → many keyword values

You might also like