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.