Python की मूल बातें

Python में Hello World

हर Python प्रोग्राम print() से शुरू होता है: यह टेक्स्ट को स्क्रीन पर लिखता है, यानी आप देख पाते हैं कि आपका कोड क्या कर रहा है।

में Hello World क्या है?

हर Python प्रोग्राम print() से शुरू होता है: यह टेक्स्ट को स्क्रीन पर लिखता है, यानी आप देख पाते हैं कि आपका कोड क्या कर रहा है।

अपना पहला Python प्रोग्राम लिखें और print() से टेक्स्ट दिखाएँ।

इसका उपयोग कब करें?

  • चलने योग्य code से Python syntax सीखें।
  • बड़ी programming समस्याओं से पहले मजबूत आधार बनाएँ।
  • स्थानीय setup के बिना किसी विचार को तुरंत जाँचें।

उदाहरण कोड

कोड चलाएँ →
main.py
# print() writes text to the screen, followed by a new line.
print("Hello, World!")

# Several values in one call are separated by a space.
print("Python", "is", "fun")

# sep and end change what goes between values and at the end of the line.
print("2026", "11", "01", sep="-")
print("No new line here...", end=" ")
print("continued on the same line.")

अपेक्षित आउटपुट

Hello, World!
Python is fun
2026-11-01
No new line here... continued on the same line.

यह कैसे काम करता है

print() कई values ले सकता है और उनके बीच space देता है। sep argument उस separator को बदलता है, और end आख़िर में छपने वाली new line को बदलता है।

मान बदलें और Python इंस्टॉल किए बिना CodeUtility ऑनलाइन Python कंपाइलर में प्रोग्राम चलाएँ।

अभ्यास के कार्य

बड़े dataset पर जाने से पहले input बदलें और edge cases की जाँच करें।

  1. Code चलाने से पहले output का अनुमान लगाएँ।
  2. खाली और गलत input संभालें।
  3. Logic को function में रखें और tests जोड़ें।
Python IDE में चलाएँ →

चैलेंज से अभ्यास करें

इस पाठ में सीखी बात से एक असली समस्या हल करें। हर चैलेंज ब्राउज़र में चलता है, तुरंत टेस्ट और AI रिव्यू के साथ।

सभी चैलेंज