Python | Data Types | Number & it's Conversion By. Shivansh Sir
PYTHON PROGRAMMING
PYTHON | DATA TYPES | NUMBERS
Numbers Data Types में numeric values; store की जाती है | Python में Integer (int), Floating-Point (float) और Complex (complex) ये तीन प्रकार के Numbers data types होते है | Number Objects immutable होते है, मतलब जब Number Object को create किया जाता है तब उसकी value बदली नहीं जा सकती है |
Number Data Types के तीन प्रकार होते है |
- Integer Number Data Type
- Floating-point Number Data Type
- Complex Number Data Type
Note :- type() function का इस्तेमाल data type check करने के लिए किया जाता है |
1. Integer Number Data Type :- Integer data type ये normal numeric values होती है | integer numbers को अपूर्णांकित हिस्सा नहीं होता है |
Source Code
a = 5
b = 12545885
c = 412154986446513513878678541351865465
print(a)
print(b)
print(c)
print(type(a))
print(type(b))
print(type(c))
Output
5
12545885
412154986446513513878678541351865465
2. Floating-point Number Data Type :- Floating-point numbers को अपूर्णांकित हिस्सा होता है | Python में floating-point number के लिए कोई मर्यादा नहीं होती है |
Source Code
a = 5.0
b = 12545885.568444444444445
c = 412154986446513513878678541351865465.4547878541516546845
print(a)
print(b)
print(c)
print(type(a))
print(type(b))
print(type(c))
Output :
5.0
12545885.568444444
4.121549864465135e+35
3. Complex Number Data Type :- Complex data type 'a + bj' इस form में होता है इसमे 'a' ये real part होता है और 'b' ये imaginary part होता है |
Source Code
a = 1 + 4j
b = 5 + 4758499j
print(a)
print(b)
print(type(a))
print(type(b))
Output
(1+4j)
(5+4758499j)
Comments
Post a Comment