Python Chapter 2
Chapter 2 Python Modules
Yahan aap dekhoge ke Python bahar se cheez kaise laata hai. Simple examples ke sath `import`, `random` aur `datetime` samajh aayega.
Cheez ko andar kaise laate hain?
Yahan dekho ke Python me doosri file ki cheez kaise use karte hain.
import random
print(random.randint(1, 10))Ready
Random number banao
Do number do, phir dekho Python un ke beech me koi aik number chun leta hai.
import random
print(random.randint(1, 10))Aaj ki date aur time dekho
Yeh tool dikhata hai ke Python abhi ki date aur time kaise laata hai.
import datetime
print(datetime.datetime.now())Abhi ka example
Current date/time yahan update hogi.
Bari cheez ke andar chhoti cheezein
Yahan dekho ke package ke andar module hota hai aur module ke andar function hota hai.
stdlib/ |-- random | |-- randint() |-- datetime |-- now()Common Mistakes
- Wrong module name likhna, jaise radnom ya dattime.
- Module aur package ko same samajhna.
- `from module import function` aur `import module` ka farq na samajhna.
Quick Quiz
Import syntax aur module/package difference ko test karo.
Module ko kaunsi analogy se samjha sakte hain?
Kaunsa import syntax sahi hai?
Package ko kaise samjhen?
Is se kya faida hota hai?
- `import` syntax short question me aasakti hai
- `random` aur `datetime` examples concept clarity dete hain
- Functions ke baad modules samajhne se coding questions easy lagte hain
More Python Topics
Back to Core Python Topics
Modules ke baad chapter ke core exam topics bhi yahan se revise kar sakte hain.
Variables
Variable naming, assignment aur basic examples yahan se prepare karo.
Open topic ->
Data Types
int, float, string aur boolean ko examples ke sath yahan se samjho.
Open topic ->
Operators
Arithmetic aur comparison operators ko exam style me yahan se cover karo.
Open topic ->
Input / Output
Input aur print output ko visual practice ke sath yahan se samjho.
Open topic ->
Loops
For loop, while loop aur board-style loop questions yahan se cover karo.
Open topic ->
Comments
Code aur comment ka farq examples ke sath samjho.
Open topic ->
Programs
Output, coding aur board-style practical questions yahan se practice karo.
Open topic ->