Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
0 views

Python Keywords Notes

The document provides an overview of Python keywords categorized by their functionality, including conditional statements, loops, functions, lists, exception handling, file handling, module importing, logical operators, and object-oriented programming concepts. Each keyword is explained with its purpose and usage in Python syntax. It serves as a reference for understanding the reserved words in Python programming.

Uploaded by

shamsherataliva
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 views

Python Keywords Notes

The document provides an overview of Python keywords categorized by their functionality, including conditional statements, loops, functions, lists, exception handling, file handling, module importing, logical operators, and object-oriented programming concepts. Each keyword is explained with its purpose and usage in Python syntax. It serves as a reference for understanding the reserved words in Python programming.

Uploaded by

shamsherataliva
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/ 3

Python Keywords & Explanation

Python All Keywords (With Explanation - Chapter Wise)

Python ke keywords reserved words hote hain jo syntax define karte hain. Yeh variables ke naam
nahi ho sakte.
Neeche har chapter ke keywords ka explanation diya gaya hai.

------------------------------------
1. Conditional Statements (Decision Making)
------------------------------------
Keywords: if, elif, else
- if - Condition check karta hai. Agar condition true hai, toh code execute hoga.
- elif - Extra condition check karne ke liye use hota hai, agar pehli condition false ho.
- else - Jab koi bhi condition true nahi hoti, tab else block execute hota hai.

------------------------------------
2. Loops (Repetition)
------------------------------------
Keywords: for, while, break, continue, pass
- for - Sequence ke har element par loop chalayega.
- while - Jab tak condition True hai, tab tak chalega.
- break - Loop ko turant stop kar deta hai.
- continue - Current iteration ko skip karke next iteration pe chala jata hai.
- pass - Ek empty statement hai jo syntax error hone se bachata hai.

------------------------------------
3. Functions (Reusable Code)
------------------------------------
Keywords: def, return, lambda
- def - Function define karne ke liye.
- return - Function ka result return karta hai.
- lambda - Ek anonymous function banane ke liye.

------------------------------------
4. Lists & Arrays
------------------------------------
Keywords: append, insert, remove, sort, pop, extend
- append() - Last me element add karta hai.
- insert() - Specific position pe element add karta hai.
- remove() - Specific element ko delete karta hai.
- sort() - Elements ko sort karta hai.
- pop() - Last element delete karta hai.
- extend() - Ek list me dusri list ke elements add karta hai.

------------------------------------
5. Exception Handling (Error Control)
------------------------------------
Keywords: try, except, finally, raise
- try - Error hone wale code ko handle karta hai.
- except - Error aane par alternate code execute karta hai.
- finally - Ye block hamesha execute hota hai.
- raise - Manually error generate karne ke liye use hota hai.

------------------------------------
6. File Handling
------------------------------------
Keywords: open, read, write, with
- open() - File ko open karta hai.
- read() - File ka content read karta hai.
- write() - File me likhne ke liye use hota hai.
- with - File ko safely handle karta hai.

------------------------------------
7. Importing Modules
------------------------------------
Keywords: import, from, as
- import - Kisi module ko import karne ke liye.
- from ... import - Kisi specific function ya class ko import karne ke liye.
- as - Module ka short name dene ke liye.

------------------------------------
8. Logical Operators
------------------------------------
Keywords: and, or, not, is, in
- and - Jab dono conditions true honi chahiye.
- or - Jab koi ek condition true ho.
- not - Condition ko ulta kar deta hai.
- is - Object identity check karta hai.
- in - Check karta hai ki ek value kisi list ya string me hai ya nahi.

------------------------------------
9. Object-Oriented Programming (OOP Concepts)
------------------------------------
Keywords: class, self, super
- class - Ek blueprint hota hai object banane ke liye.
- self - Current object ka reference hota hai.
- super - Parent class ke methods ko call karne ke liye use hota hai.

Summary (Important Keywords)


- Conditional Statements: if, elif, else
- Loops: for, while, break, continue, pass
- Functions: def, return, lambda
- Lists & Arrays: append, insert, remove, sort, pop, extend
- Exception Handling: try, except, finally, raise
- File Handling: open, read, write, with
- Modules Import: import, from, as
- Logical Operators: and, or, not, is, in
- OOP Concepts: class, self, super

You might also like