Python · Chapter 2.2 · Basic level

Data Types & Smart Calculator (+, -, *, /)

4 डेटा टाइप्स और स्मार्ट कैलकुलेटर (+, -, *, /)

Python stores 4 main flavours of data: str (text in quotes "Rahul"), int (whole numbers 50), float (decimal numbers 99.5), and bool (True or False). And Python is a super-fast calculator! Just remember one golden symbol: on computers, multiplication is written with a star * (never x), and division is a slash /!

Python में 4 तरह का सामान (Data Types) रखा जाता है: str (कोट्स वाला टेक्स्ट "Rahul"), int (पूरा नंबर 50), float (दशमलव वाला नंबर 99.5), और bool (सिर्फ़ True या False)। और याद रखो: कंप्यूटर में गुणा (Multiply) करने के लिए हमेशा स्टार * लगता है (x नहीं!), और भाग (Divide) के लिए / लगता है!

In the classroom you can run and edit this code in your browser, get hints and mark the chapter as done. क्लास में यह code ब्राउज़र में चलाकर बदल सकते हो।

Words and symbols in this chapter

int (10, 50)
Integer — whole numbers without any decimal point.
Integer — बिना दशमलव (point) वाली पूरी संख्याएँ।
float (99.5)
Float — numbers containing a decimal point ..
Float — दशमलव (.) वाली संख्याएँ।
bool (True / False)
Boolean — Yes (True) or No (False), first letter Capital!
Boolean — हाँ (True) या ना (False), पहला अक्षर कैपिटल!
+ और -
Addition (+) and Subtraction (-).
जोड़ना (+) और घटाना (-)।
* (Star)
Multiplication — 10 * 5 gives 50.
गुणा (Multiply) — 10 * 5 का नतीजा 50 आता है।
/ (Slash)
Division — 10 / 2 gives 5.0.
भाग (Divide) — 10 / 2 का नतीजा 5.0 आता है।

Ready example

a = 10
b = 5
multiply = a * b
price = 99.5
is_winner = True

print("10 x 5 =", multiply)
print("Item Price:", price)
print("Winner Status:", is_winner)

What you will see: See the live [a: 10] × [b: 5] → [Result: 50] calculator animation plus typed memory boxes!

प्रिव्यू में [a: 10] × [b: 5] → [Result: 50] का लाइव कैलकुलेटर कार्ड और सभी डेटा टाइप्स के डिब्बे दिखेंगे!

Line by line

a = 10 / b = 5
Creates two integer boxes a (10) and b (5).
दो नंबर डिब्बे a (10) और b (5) बनाए।
multiply = a * b
Multiplies a and b using * and stores 50 in multiply.
* से दोनों का गुणा करके 50 को multiply में रखा।
price = 99.5 / is_winner = True
Examples of float (decimal) and bool (True/False).
float (दशमलव) और bool (True) के उदाहरण।

Common mistake

✗ Wrong

ans = 10 x 5
winner = true

✓ Right

ans = 10 * 5
winner = True

Use * (not x) for multiplication, and capitalize True / False in Python!

गुणा करने के लिए x नहीं बल्कि स्टार * लगता है, और Python में True/False का पहला अक्षर Capital होता है!

Your task

Create a = 10 and b = 5 (or any two numbers whose product is 50), multiply them with *, and print(a * b)!

a = 10 और b = 5 बनाओ, दोनों को * से गुणा करो, और print(a * b) चलाओ!

  1. Write a = 10 on line 1 and b = 5 on line 2.
    लाइन 1 पर a = 10 और लाइन 2 पर b = 5 लिखो।
  2. Write print(a * b) using the * star symbol.
    स्टार * का उपयोग करके print(a * b) लिखो।
  3. Click ▶ Run & Preview to see 50!
    ▶ Run & Preview दबाकर 50 का लाइव विज़ुअल देखो!
Starter code for the task
# Smart Calculator
a = 10
# TODO 1: b = 5 likho
# TODO 2: print(a * b) likho (multiply ke liye * star lagta hai, x nahi)

Do this task in the classroom: your code is checked automatically and you get hints if something is missing.

Recap

Quick quiz

What is the data type of 99.5 and which symbol multiplies in Python?

Python में 99.5 का डेटा टाइप और गुणा (Multiply) का चिह्न क्या है?

  1. int and x
  2. float and *
  3. str and *
  4. float and /
Show the answer

Answer: B (float and *)

Decimal numbers are float, and * is the multiplication operator!

दशमलव संख्या float कहलाती है और गुणा के लिए स्टार * लगता है!

Practice problems for this chapter

Solve them in the Practice Zone, where each answer is checked automatically and two hints are available.