सभी उदाहरण

उदाहरण

Python की दो लाइनों में गलती ढूंढें

छूटे हुए कोलन वाला for लूप: गलती ढूंढी गई, Python कुछ भी प्रिंट करने से पहले क्यों रुक जाता है, फिर सुधरी हुई लाइन।

  • 0:45
  • कोड के सवाल
  • Erinome की आवाज़ में
  • अंग्रेज़ी

प्रॉम्प्ट से बना

Find the error: for i in range(5) print(i)

वीडियो की ट्रांसक्रिप्ट

In this video, we find and fix a Python syntax error.

Question one. Find the error: The first line reads for i in range, with five in parentheses. The indented second line reads print, with i in parentheses.

Notice that line one is missing a colon after the closing parenthesis. Python requires a colon at the end of a for loop header. Without it, Python raises a SyntaxError before either line executes, so nothing is printed.

The indentation of print is correct and does not need changing. Hence, the corrected first line is for i in range, open parenthesis, five, close parenthesis, colon.

आपका टॉपिक, करीब एक मिनट में बनकर तैयार।

आपके पहले 2 वीडियो फ़्री हैं, हर वीडियो 1 मिनट तक का, वॉटरमार्क के साथ। कार्ड की ज़रूरत नहीं। पूरा प्रोडक्ट, हर आवाज़ और हर स्टाइल समेत।