Yandex

Python Data Types



In Python, data comes in different types. Just like in real life, where you have different kinds of things — like numbers, words, and yes/no answers — Python also needs to know what kind of data you're using.

Why Are Data Types Important?

Python uses data types to decide what you can do with the data. For example, you can add two numbers, but you can’t add a number to a word directly.

Common Data Types in Python

Here are some of the most common data types you'll use:

  • int – whole numbers (like 5, -2, 100)
  • float – decimal numbers (like 3.14, -0.5, 2.0)
  • str – text, also called a “string” (like "Hello", "Python")
  • bool – True or False (used for yes/no decisions)

Examples

number = 10           # int
pi = 3.14             # float
name = "Alice"        # str
is_happy = True       # bool

How to Check the Data Type

You can use the type() function to see what kind of data something is:

print(type(10))       # <class 'int'>
print(type("Hi"))     # <class 'str'>
print(type(3.5))      # <class 'float'>
print(type(False))    # <class 'bool'>

Conclusion

Every value in Python has a type. Understanding these basic data types will help you store, use, and work with information in your programs.



Welcome to ProgramGuru

Sign up to start your journey with us

Support ProgramGuru.org

You can support this website with a contribution of your choice.

When making a contribution, mention your name, and programguru.org in the message. Your name shall be displayed in the sponsors list.

PayPal

UPI

PhonePe QR

MALLIKARJUNA M