Python course for beginners
Python प्रोग्रामिंग कोर्स (हिंदी + English)
Start with what a program is and how to read your first error. Then learn print and variables, data types and a small calculator, decisions with if/elif/else, for and while loops, lists and dictionaries, functions, f-strings, input() with int(), error handling with try/except, and classes and objects. The capstone is a report-card manager that uses lists of dictionaries, lambda and comprehensions.
शुरुआत इससे कि program क्या होता है और पहली error कैसे पढ़ें। फिर print और variables, data types और छोटा calculator, if/elif/else से फ़ैसले, for और while loops, lists और dictionaries, functions, f-strings, input() और int(), try/except से error handling, और classes व objects। आख़िर में एक report-card manager बनता है जिसमें lists of dictionaries, lambda और comprehensions इस्तेमाल होते हैं।
- 12 chapters in four levels: Start, Basic, Intermediate and Pro
- 11 practice problems with automatic checks and hints
- a quiz question in every chapter, plus 9 viva and interview questions
- free, no sign-up; works on a phone or a computer
How the code runs: Code runs in a small Python interpreter written in JavaScript that covers everything used in these lessons. It is not the full Python language; for bigger programs, install Python from python.org. Code JavaScript में लिखे एक छोटे Python interpreter में चलता है, जो इन lessons की सारी चीज़ें सपोर्ट करता है। यह पूरा Python नहीं है; बड़े programs के लिए python.org से Python इंस्टॉल करें।
Start Here level
- 2.0Start Here: What is a Program? (Hello + Your First Error)
A program runs top to bottom, one line at a time.
Basic level
- 2.1Talk to the Computer (print & Variables)
print(...)shows output on the screen. - 2.2Data Types & Smart Calculator (+, -, *, /)
Four basic types:
str(text),int(whole number),float(decimal),bool(True/False). - 2.3Decision Power (if, elif, else)
if,elifandelselet the program choose a path. - 2.4Loops (for — Automatic Robot Machine!)
for i in range(5):repeats the indented block 5 times.
Intermediate level
- 2.5Lists & Dictionaries (Train Bogies & Contact Book)
A list
[ ]stores many values in order:fruits = ["Apple", "Mango"]. - 2.6Functions (def — Doraemon's Gadget Pocket!)
def name(params):builds a reusable function once. - 2.7Bonus: Modern f-Strings & while Rocket Countdown
An f-string puts variables inside text:
f"Score: {points}". - 2.8Talking to the User: input(), int() & String Superpowers
input()always returns text — wrap it inint()/float()for maths.
Pro level
- 2.9Error Handling: try / except (Programs That Never Crash)
Risky code goes in
try:; the rescue goes inexcept ErrorType:. - 2.10OOP in Python: Classes & Objects (Make Your Own Game Character)
Class = blueprint, object = real thing made with
ClassName(...). - 2.11Capstone: Report Card Manager (lists of dicts, lambda, comprehensions, modules)
Store records as a list of dictionaries.
Practice problems
Each problem is linked to a chapter. Read them on the practice page and solve them in the Practice Zone.
- Cricket Player Card (variables + print)
- Kirana Shop Bill (maths with numbers)
- Fix the Grade Machine (if / elif / else)
- Predict: How Many Overs?
- Train Seat Chart (list + dictionary)
- Tiffin Service Bill Function (fill the blanks)
- Piggy Bank Goal (while loop + f-string)
- Predict: String Superpowers
- Safe ATM Withdrawal (input + try / except / raise / finally)
- Fix the UPI Wallet Class
- Mini Project: Class Result Manager
Viva and interview questions
Why is Python so popular for beginners and AI?
Python reads almost like plain English, needs far fewer lines of code than C++/Java, and has the world's richest AI & Data Science ecosystem (scikit-learn, PyTorch, TensorFlow).
Python शुरुआती छात्रों और AI के लिए दुनिया की नंबर-1 भाषा क्यों है?
Python बिल्कुल आसान अंग्रेज़ी जैसी दिखती है, कम लाइनों में बड़ा काम करती है, और दुनिया की सबसे मज़बूत AI लाइब्रेरीज़ (scikit-learn, PyTorch) इसी में हैं।
What is Indentation in Python and what happens if you skip it?
Python uses 4 leading spaces instead of { } braces to group code inside if, for, while, and def. Skipping it raises an IndentationError.
Python में Indentation (4 Spaces) क्या है और इसे छोड़ने पर क्या होता है?
Python में { } की जगह लाइन की शुरुआत में 4 स्पेस देकर बताया जाता है कि कौन-सी लाइन if, for या def के अंदर है। इसे भूलने पर IndentationError आता है।
What is the difference between a Python list [ ] and dict { }?
A List stores ordered items accessed by numeric position (items[0]). A Dictionary stores key: value pairs accessed by meaningful key names (student["naam"]).
Python में List [ ] और Dictionary { } में क्या अंतर है?
List [ ] क्रम से रखे आइटम्स की सूची है जहाँ नंबर ([0], [1]) से सामान निकालते हैं। Dictionary { } में नाम: वैल्यू की जोड़ी होती है (student["naam"])।
Difference between = and == in Python?
= is the Assignment operator (x = 10 puts 10 into box x). == is the Comparison operator (x == 10 checks if x equals 10 and returns True or False).
Python में = और == में क्या अंतर है?
= वेरिएबल डिब्बे में वैल्यू रखने का चिह्न है (x = 10), जबकि == दो चीज़ों की तुलना करके True या False बताता है!
Difference between print() and return inside a Python function?
print() merely displays text on the screen, whereas return sends the calculated value back to the caller so you can store it in a variable or use it in further math!
फ़ंक्शन के अंदर print() और return में क्या अंतर है?
print() सिर्फ़ स्क्रीन पर दिखाता है, जबकि return फ़ंक्शन का असली नतीजा बाहर वापस भेजता है ताकि उसे किसी वेरिएबल में सेव करके आगे इस्तेमाल किया जा सके!
When should you use a for loop vs a while loop?
Use for when you know the collection or number of turns upfront (range(10) or a list). Use while when repeating until a dynamic condition changes (e.g., while fuel > 0:).
for लूप और while लूप कब-कब इस्तेमाल करने चाहिए?
जब चक्करों की संख्या या लिस्ट पहले से पता हो तो for लूप लगाएँ। और जब किसी शर्त के सच रहने तक काम दोहराना हो (while count > 0:) तब while लूप लगाएँ।
Why do we use try/except instead of letting the program crash?
Users type unexpected things (e.g. "abc" for a number). try: runs the risky code and except ValueError: shows a friendly message, so the program keeps running. finally: runs the clean-up every time.
प्रोग्राम को crash होने देने की जगह try/except क्यों इस्तेमाल करते हैं?
यूज़र अनचाही चीज़ें लिख देते हैं (जैसे नंबर की जगह "abc")। try: जोखिम वाला कोड चलाता है और except ValueError: प्यारा संदेश दिखाता है, इसलिए प्रोग्राम चलता रहता है। finally: हर बार सफ़ाई वाला काम करता है।
What is self in a Python class?
self is the object that called the method. In arjun.take_hit(30), inside take_hit the word self means arjun, so self.hp is Arjun’s own HP.
Python class में self क्या है?
self वह object है जिसने method बुलाया। arjun.take_hit(30) में, take_hit के अंदर self का मतलब arjun है, इसलिए self.hp अर्जुन की अपनी HP है।
What is a list comprehension? Give an example.
A short way to build a list in one line: [s["name"] for s in students if s["marks"] >= 60] gives the names of all students with 60 or more marks.
List comprehension क्या है? एक उदाहरण दो।
एक लाइन में list बनाने का छोटा तरीका: [s["name"] for s in students if s["marks"] >= 60] उन सभी छात्रों के नाम देता है जिनके 60 या ज़्यादा marks हैं।
Ready mini projects
- Smart Restaurant Bill & Discount: Uses Python variables, math, and
if-elsediscount rules with visual memory boxes! - Any Number Multiplication Table: Change
num = 7to any number (13,19,25) and generate its full table instantly! - CBSE Exam Grade & Percentage Generator: Calculates total marks, percentage, and A+/A/B grade using lists, functions & f-strings!
Open them in the Projects section of the classroom to run and change the code.