Afiz ⚡️
Afiz ⚡️

@itsafiz

9 Tweets 5 reads Sep 26, 2022
Built-in Data Types in Python (with code snippets)
In Python, every value has a data type. There are various data types and in this thread, we will discuss some of the important ones.
A Thread 🧵👇
1️⃣ Python Numbers
Numbers are three types in Python
1. Integers
2. floating point numbers
3. complex numbers
2️⃣ Strings in Python
A string is a sequence of characters. In Python single, double, and triple quotes are used to define strings.
3️⃣ List in Python
Python list is an ordered sequence of items. We can store more than one item of different types in a list. Items in the list are accessed using an index.
4️⃣ Tuple in Python
Tuple is an ordered sequence of items same as list. The difference is that tuples are immutable and list is mutable.
5️⃣ Python Set
Set is an unordered collection of unique items, which means duplicates are not allowed. Set is defined using {} and items in set are separated by commas. set items are not ordered
✅ Note on Sets
Set items can’t be accessed using index as they are unordered.
6️⃣ Dictionary in Python
Dictionary is an unordered collection of key-value pairs. Dictionary is defined using {} and each item is a pair of keys and value.
That's a wrap!
I hope you like this content!
I create content around Python, NLP and ML.
Follow me at @itsafiz, if you don't want to miss anything.
RT 🔁 and Like ❤️ the first tweet for better reach!
Cheers 🎉

Loading suggestions...