Lesson 3 of 34

Data Types: संख्याएँ, टेक्स्ट और True/False

8 min 20 XP

Python में हर मान का एक type होता है: पूर्ण संख्याएँ int, दशमलव float, टेक्स्ट str, और True/False bool। type() बताता है कि मान किस type का है।

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

ध्यान दें: "10" टेक्स्ट (string) है, जबकि 10 एक संख्या है। दो strings को जोड़ने पर वे आपस में जुड़ जाती हैं। गणना के लिए int() से उन्हें संख्या में बदलें।

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

int("5") → 5, float("2.5") → 2.5, str(10) → "10"। इसे type conversion कहते हैं।

Challenge

+20 XP

price = "250" एक string है और qty = 3 है। कुल राशि (price × qty) निकालकर print करें। सही उत्तर 750 है।

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.