Data Structures
Data Structure का मतलब है कि डेटा को संगठित (Organize), संग्रहित (Store) और
प्रबंधित (Manage) करने का तरीका।
उदाहरण के लिए =>
आप 200 किताबें एक कमरे में इधर-उधर फेंक देते है | तो किसी स्पेशल book को ढूँढने में घंटों लग जायेगें।
अगर वही 200 किताबें अगर क्रम मे रखें तब कुछ seconds ही लगेगें।
Data Types
Varriables मे stored Data के type को Data Type कहा जाता है |
data types दो प्रकार के होते है |
1.Mutable
2.Immutabel
(Mutabel Data Types :)
Mutabel data types वो होते है | जिनके अन्दर बदलाव (change) किये जा सकते है | कुछ Mutable data types
निम्न्लिखित है |
list
dict (Dictionary)
set
(1.List)
python programming के अन्दर lists कुछ इस प्रकार create की जाती है |
list एक mutable data type होती है | यानी create की गई list के अन्दर बदलाव (change) किये जा सकते है | बहुत सारे items store करने के लिए list का किया जाता है | list के लिए Square brackets [] का प्रयोग होता है।
(2.Dictionaries)
Dictionaries को Curly brackets {} और colon : मे defin किया जाता है। python programming के अन्दर Dictionaries
कुछ इस प्रकार create की जाती है |
(3.Sets)
Set unique elements का unordered collection होता है। और set Duplicate values नहीं रखता। set के लिए Curly brackets {} का प्रयोग होता है। एक set कुछ इस प्रकार create होता है |
(Immutabel Data Types :)
Immutabel Data Types वो होते है | जिनके अन्दर बदलाव (change) नही किये जा सकते है | कुछ Immutable
data types
निम्न्लिखित है |
String
Tuple
Numbers (int, float, complex)
Frozen set
(1.String)
string एक immutable data type है | Text data को store करने के लिए string का प्रयोग किया जाता है | string को ' ' (single quotes), " " (double quotes) या """ """ (multi-line) मे लिखा किया जाता है |
(2.Tuple)
Tuple एक Immutabel data type है | यानि Tuple को एक बार create कर लेने के बाद उसके अन्दर changes नही किए जा सकते है | Tuple के लिए ()Round brackets का प्रयोग किया जाता है |
Numbers
Number का उपयोग Arithmetic और अन्य संख्यात्मक (numerical)
Operations को perform करने के लिए किया जाता है | Numbers एक Immutabel Data Type है |
Python मे Numbers तीन प्रकार के होते है |
Integer
python मे Integer को short मे int से define किया जाता है | 1,2,3,4,5,6, आदि (Et Cetera) Integer numbers है | Integer पूरे संख्याएं (whole numbers) होती हैं यानि Integer numbers मे दशमलव (decimal) नहीं होता।
<class 'int'></class>
Float
3.14, -0.5, 2.01,2,3,4,5,6, आदि (Et Cetera) Float numbers है | Float numbers वे होते जिनमे दशमलव (decimal) होता। ये Float value Negative या positive हो सकती है |
Complex Number
a + bj
एक complex number है | python मे complex numbers को दो parts मे devide किया गया
है |
Real and imaginary complex number (real) और(imaginary) भागों से मिलाकर बनता है।
Frozen set
Frozen set set का immutable version है | यानि कि set मे changes किए जा सकते है | जबकि Frozen set मे changes नही किए जा सकते है | वो सभी operations जो set पर किए जा सकते है | forzen set पर भी किए जा सकते है |
frozenset({'Tiger', 'Cow', 'Raino'})