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) के लिए / लगता है!
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 * 5gives50. - गुणा (Multiply) —
10 * 5का नतीजा50आता है। / (Slash)- Division —
10 / 2gives5.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) andb(5). - दो नंबर डिब्बे
a(10) औरb(5) बनाए। multiply = a * b- Multiplies
aandbusing*and stores50inmultiply. *से दोनों का गुणा करके50कोmultiplyमें रखा।price = 99.5 / is_winner = True- Examples of
float(decimal) andbool(True/False). float(दशमलव) औरbool(True) के उदाहरण।
Common mistake
✗ Wrong
ans = 10 x 5
winner = true✓ Right
ans = 10 * 5
winner = TrueUse * (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) चलाओ!
- Write
a = 10on line 1 andb = 5on line 2.
लाइन 1 परa = 10और लाइन 2 परb = 5लिखो। - Write
print(a * b)using the*star symbol.
स्टार*का उपयोग करकेprint(a * b)लिखो। - 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
- Four basic types:
str(text),int(whole number),float(decimal),bool(True/False). - Maths uses
+ - * /; multiply with*(neverx). TrueandFalsestart with a capital letter in Python.
- चार मुख्य टाइप:
str(टेक्स्ट),int(पूर्ण संख्या),float(दशमलव),bool(True/False)। - गणित में
+ - * /लगते हैं; गुणा*से (कभीxनहीं)। - Python में
TrueऔरFalseकैपिटल अक्षर से शुरू होते हैं।
Quick quiz
What is the data type of 99.5 and which symbol multiplies in Python?
Python में 99.5 का डेटा टाइप और गुणा (Multiply) का चिह्न क्या है?
Show the answer
Answer: B (float and *)
Decimal numbers are float, and * is the multiplication operator!
दशमलव संख्या float कहलाती है और गुणा के लिए स्टार * लगता है!
Practice problems for this chapter
- Kirana Shop Bill (maths with numbers)
किराना दुकान का बिल (नंबरों से गणित)
Solve them in the Practice Zone, where each answer is checked automatically and two hints are available.