Modules aur Standard Library
Python ek badi standard library ke saath aata hai — math, dates, random numbers, file handling, aur bahut kuch ke liye modules — sab kuch bina kuch install kiye available hai, bas import likh kar.
import math print(math.sqrt(16)) print(math.pi) print(math.ceil(4.2)) print(math.floor(4.8))
4.0 3.141592653589793 5 4
Ek baar import karne ke baad, module ki har cheez module.thing se access hoti hai — math.sqrt, math.pi, waghera. random module bhi waise hi kaam karta hai, aur seed se reproducible banaya ja sakta hai:
random.seed() ke bina, har run par aapko ek alag number milega — seed karne se sequence deterministic ho jaati hai, isi wajah se upar wala output guaranteed hai ki match karega agar aap yehi exact code khud run karo.
Yahan kya chalta hai, aur kya nahi
Yeh compiler har submission ko ek isolated sandbox mein run karta hai jisme koi internet access nahi hai aur runs ke beech koi persistent storage nahi hai. Iska matlab hai ki Python ki standard library modules (math, random, datetime, json, collections, waghera) sab bilkul waise hi kaam karte hain jaise upar dikhaya gaya — lekin pip install wale third-party packages (jaise requests, pandas, ya numpy) available nahi hain, kyunki inhe install karne ke liye network access nahi hai.
Language khud seekhne ke liye, standard library is tutorial mein sab kuch cover karti hai. Agar baad mein kisi real project ke liye third-party package chahiye ho, tab aap local Python install ya poore project environment par move karoge.
Bas itni hi language ka core hai. Yahan se, best next step hai practice — koi chhota sa idea pick karo aur use in lessons mein jo seekha hai usse use karke banao.
Practice Exercise
math module import karo aur math.sqrt() use karke 81 ka square root print karo.