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.