Data types:- Python में variables के अन्दर अलग-अलग types की values store की जाती है जैसे कि किस variable के अन्दर numeric value तो किसी दूसरे variable के अन्दर alphabetic value store की जाती है, इसे ही 'Data Types' कहा जाता है
Python में 4 प्रकार के Data Types होते है |
• integer data type
• float data type
• String Data Type
• complex data type
1. int data type :-
int data type मे सिंपल न्यूमेरिक वैल्यू होती है | ये वैल्यू नेगेटिव तथा पॉजिटिव दोनों प्रकार की होती है |
उदहारण :-
a= 14582
print(“positive int no .= “, a)
आउटपुट :- positive int no . = 14582
b= -1345
print(“negative int no .= “, b)
आउटपुट :- negative int
no . = -1345
2. Float data type:-
Float data type मे दशमलव वैल्यू होती है | ये भी नेगेटिव तथा पॉजिटिव दोनों प्रकार की होती है |
उदहारण :-
a= 2525.5455
print(“positive float no . =”, a)
आउटपुट :- positive float no . = 2525.5455
b= -2165.13155
print(“negative float no . =”, b)
आउटपुट :- negative float no . = -2165.13155
3. String :-
पाइथन string characters या text का sequence होता है | यह textual डाटा को handle करता है | string को single(‘ ‘) या double (“ “) quotes के अंदर लिख़ते है |
पाइथन string की forward indexing 0 ,1 ,2 ,3 …… से शुरू होती है जबकि backward indexing -1 , -2 , -3 ……. से शुरू होती है |
उदहारण :-
a= “ehindistudy”
b=’ hello python’
print(a)
print(b)
आउटपुट :- ehindistudy
Hello python
4.complex data type:-
complex data type मे दो part होते है | पहला real part दूसरा imaginary part होता है |
उदहारण :-
a=3+5j
print (“complex no = ”, a)
आउटपुट :- complex no = (3+5j)
3=real part & 5j = imaginary part