TGViewer
Data Science & Machine Learning Data Science & Machine Learning @datasciencefun · 77.8K subscribers
Post #3919 6.15K
✅ Python Basics for Data Science: Part-1

Variables Data Types

In Python, variables are used to store data, and data types define what kind of data is stored. This is the first and most essential building block of your data science journey.

1️⃣ What is a Variable?
A variable is like a label for data stored in memory. You can assign any value to a variable and reuse it throughout your code.

Syntax:
x = 10  
name = "Riya"
is_active = True


2️⃣ Common Data Types in Python

• int – Integers (whole numbers)
age = 25

• float – Decimal numbers
height = 5.8

• str – Text/String
city = "Mumbai"

• bool – Boolean (True or False)
is_student = False

• list – A collection of items
fruits = ["apple", "banana", "mango"]

• tuple – Ordered, immutable collection
coordinates = (10.5, 20.3)

• dict – Key-value pairs
student = {"name": "Riya", "score": 90}


3️⃣ Type Checking
You can check the type of any variable using type()
print(type(age))       # <class 'int'>  
print(type(city)) # <class 'str'>


4️⃣ Type Conversion
Change data from one type to another:
num = "100"
converted = int(num)
print(type(converted)) # <class 'int'>


5️⃣ Why This Matters in Data Science
Data comes in various types. Understanding and managing types is critical for:
• Cleaning data
• Performing calculations
• Avoiding errors in analysis

✅ Practice Task for You:
• Create 5 variables with different data types
• Use type() to print each one
• Convert a string to an integer and do basic math

💬 Tap ❤️ for more!
  • ❤ 17
  • 👍 4
More from @datasciencefun
  1. Oct 17, 2026𝗜𝗕𝗠 𝗙𝗥𝗘𝗘 𝗧𝗘𝗖𝗛 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝟮𝟬𝟮𝟲! 🎓 Explore IBM Cognitive Class and build…
  2. Oct 16, 2026𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍 Future Ready Data Scien…
  3. Oct 15, 2026Post #4665
  4. Oct 15, 2026Post #4664
  5. Oct 15, 2026Post #4663
  6. Oct 15, 2026Post #4662
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →