Lesson 7 of 34

ஒப்பீடுகள்: True அல்லது FalseComparisons: True or False

6 min 20 XP

இரண்டு மதிப்புகளை ஒப்பிட்டால், Python ஒரு பதிலைத் தரும்: True (உண்மை) அல்லது False (பொய்). இவற்றை Boolean என்பார்கள்.

When you compare two values, Python answers with True or False. These are called Booleans.

Example: edit me and press Run

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

= என்பது மதிப்பை வைப்பது (assign). == என்பது சமமா என்று கேட்பது (compare). இந்த இரண்டையும் குழப்பிக்கொள்ளாதீர்கள்!

= stores a value (assign). == asks “are these equal?” (compare). Don't mix them up!

Strings-ஐயும் ஒப்பிடலாம். ஆனால் பெரிய எழுத்தும் சிறிய எழுத்தும் வேறு வேறு: "Chennai" மற்றும் "chennai" சமம் அல்ல.

You can compare strings too, but capitals matter: "Chennai" and "chennai" are not equal.

Example: edit me and press Run

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

Challenge

+20 XP

price = 499, budget = 500. முதல் வரியில் price, budget-ஐ விடக் குறைவா (<) என்று print செய்யுங்கள். இரண்டாவது வரியில் price, 500-க்குச் சமமா (==) என்று print செய்யுங்கள்.

price = 499 and budget = 500. On the first line, print whether price is less than budget (<). On the second line, print whether price equals 500 (==).

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