Python · Chapter 2.0 · Start Here level
Start Here: What is a Program? (Hello + Your First Error)
शुरुआत: प्रोग्राम क्या है? (Hello + आपकी पहली Error)
A program is a list of instructions the computer follows from top to bottom, one line at a time. Python is famous because it reads almost like English. The black box under the editor is the Terminal / Console — whatever your program prints appears there. And errors are normal: if you misspell a word, Python stops and tells you the line number. Read the error, fix that line, run again. Every expert does this 100 times a day!
प्रोग्राम निर्देशों की एक लिस्ट है जिसे कंप्यूटर ऊपर से नीचे, एक-एक लाइन करके मानता है। Python इसलिए मशहूर है क्योंकि यह लगभग अंग्रेज़ी जैसी पढ़ी जाती है। एडिटर के नीचे वाला काला डिब्बा Terminal / Console है — आपका प्रोग्राम जो भी print करेगा, वहीं दिखेगा। और errors आना नॉर्मल है: स्पेलिंग गलत होने पर Python रुककर लाइन नंबर बता देता है। Error पढ़ो, वह लाइन ठीक करो, फिर चलाओ। हर एक्सपर्ट दिन में 100 बार यही करता है!
Words and symbols in this chapter
print("...")- Shows the text inside the quotes on the console.
- कोट्स के अंदर का टेक्स्ट console पर दिखाता है।
" " (quotes)- Text must be inside quotes, otherwise Python thinks it is a name.
- टेक्स्ट कोट्स के अंदर होना चाहिए, वरना Python उसे कोई नाम समझेगा।
# comment- A note for humans; Python skips everything after
#. - इंसानों के लिए नोट;
#के बाद का सब Python छोड़ देता है। Error + Line number- Python tells you WHICH line is wrong and WHAT kind of mistake it is.
- Python बताता है कि कौन-सी लाइन गलत है और गलती किस तरह की है।
Ready example
# Mera pehla Python program
print("Namaste Duniya!")
print("Main Python seekh raha hun")
print(2 + 3)
What you will see: Look at the Terminal: each print shows one line, in order from top to bottom.
Terminal देखो: हर print ऊपर से नीचे क्रम में एक लाइन दिखाता है।
Line by line
# Mera pehla Python program- A comment — Python ignores it.
- Comment — Python इसे नज़रअंदाज़ करता है।
print("Namaste Duniya!")- Prints the greeting.
- नमस्ते वाला संदेश छापता है।
print(2 + 3)- Numbers need no quotes; Python calculates and prints
5. - नंबर को कोट्स नहीं चाहिए; Python जोड़कर
5छापता है।
Common mistake
✗ Wrong
print(Namaste)✓ Right
print("Namaste")Without quotes Python searches for a variable named Namaste and gives NameError.
कोट्स के बिना Python Namaste नाम का variable ढूँढता है और NameError देता है।
Your task
Fix the error (Print → print), put your name in the message, and add one more print() with your city.
Error ठीक करो (Print → print), संदेश में अपना नाम लिखो, और अपने शहर वाला एक और print() जोड़ो।
- Run once and read the red error:
NameErroron line 2 —Printwith capital P is unknown.
एक बार Run करो और लाल error पढ़ो: लाइन 2 परNameError— कैपिटल P वालाPrintPython नहीं जानता। - Change
Printtoprintand replace...with your name.Printकोprintकरो और...की जगह अपना नाम लिखो। - Add a new line:
print("Mera shehar: Jaipur")(your city) and Run.
नई लाइन जोड़ो:print("Mera shehar: Jaipur")(अपना शहर) और Run करो।
Starter code for the task
# Neeche ki line mein GALTI hai (P capital hai). Use theek karo:
Print("Mera naam ... hai")
# TODO: ek aur print() likho jo aapke shehar ka naam dikhayeDo this task in the classroom: your code is checked automatically and you get hints if something is missing.
Recap
- A program runs top to bottom, one line at a time.
print("text")shows output; text needs quotes, numbers don't.- An error shows the line number — fix that line and run again.
- प्रोग्राम ऊपर से नीचे, एक-एक लाइन चलता है।
print("text")आउटपुट दिखाता है; टेक्स्ट को कोट्स चाहिए, नंबर को नहीं।- Error लाइन नंबर बताती है — वह लाइन ठीक करो और फिर चलाओ।
Quick quiz
What does Python do with a line that starts with #?
# से शुरू होने वाली लाइन का Python क्या करता है?
Show the answer
Answer: B (Ignores it (it is a comment))
# starts a comment — notes for humans that Python skips.
# comment शुरू करता है — इंसानों के लिए नोट जिसे Python छोड़ देता है।
More practice at this level
- Cricket Player Card (variables + print)
क्रिकेट प्लेयर कार्ड (variables + print) - Kirana Shop Bill (maths with numbers)
किराना दुकान का बिल (नंबरों से गणित) - Fix the Grade Machine (if / elif / else)
ग्रेड मशीन ठीक करो (if / elif / else)
Solve them in the Practice Zone, where each answer is checked automatically and two hints are available.