Lesson 3 of 34

Data Types: எண்கள், எழுத்துகள், True/False

8 min 20 XP

Python-ல் ஒவ்வொரு மதிப்புக்கும் ஒரு வகை (type) உண்டு: முழு எண் int, தசம எண் float, எழுத்து str, உண்மை/பொய் bool. 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.