ML Engineering/python
Python - Data types
KeepPersistStay
2024. 4. 5. 02:52
String
- Sequence of characters, enclosed –“ ”/’ ’/””” “””, ordered, immutable, duplicates allowed
- Accessing Items: Indexing ,slicing and for loop
- Functions: capitalize(), title(), upper(), lower(), lstrip() ,rstrip() ,strip(), swapcase(), replace(), find(), split(), join() ,endswith(), startswith(), del, index(), count(), isalnum(), isalpha(), isdecimal(), isdigit(), isnumeric(), islower() ,isupper(), istitle(), isspace(), zfill(),center().
List
- collection of heterogeneous datatype, enclosed –[ ], ordered, mutable duplicates allowed
- Accessing Items: Indexing ,slicing and for loop
- Functions: append(), extend(), insert(), remove(), pop(), clear(), del, sort(), reverse(), index(), count()
Tuple
- collection of heterogeneous datatype, enclosed –( ), ordered, immutable, duplicates allow
- Accessing Items: Indexing ,slicing and for loop
- Functions: Index(), count()
Set
- collection of immutable items, enclosed in –{ }.,unordered, mutable, duplicates not allows
- Accessing Items:for loop
- Functions:remove(), discard(), pop(), clear(), del, add(), update(), union(), intersection(), intersection_update, difference() ,difference_update() ,symmetric_difference, symmetric_difference_update(), issubset(), issuperset(), isdisjoint(),
Frozen set
- collection of immutable items, enclosed in –{()}.,unordered, immutable, duplicates not allow.
- Accessing Items:for loop
- Functions: Union(), intersection(), difference(), symmetric_difference.
Dictionary
- collection of key and value pairs, enclosed in –{ }., ordered, mutable, duplicates allows Keys:immutable,Values:mutables
- Accessing Items: Indexing ,slicing and for loop
- Functions: Dict_name[keyname], update(), pop(), popitems(), clear(), del, fromkeys(),setdefault().
Bool
- True and False