Python Variables and Data Types

Python Variables and Data Types | Techverse by Vijay

Techverse by Vijay

Coding Tutorial

Python Variables and Data Types

Variables are used to store data, and Python supports several data types such as integers, floats, strings, and booleans. Understanding these is essential for any Python programmer.

1. Variables

Variables store data for later use:

name = "Vijay"
age = 20
is_student = True

Here, name is a string, age is an integer, and is_student is a boolean.

2. Common Data Types

  • int: Whole numbers. Example: age = 20
  • float: Decimal numbers. Example: height = 5.9
  • str: Text. Example: name = "Vijay"
  • bool: True or False. Example: is_student = True

3. Type Checking

You can check a variable’s type using type():

print(type(age))       # <class 'int'>
print(type(height))    # <class 'float'>
print(type(name))      # <class 'str'>
print(type(is_student))# <class 'bool'>

Conclusion

Understanding variables and data types is the foundation of Python programming. Next, you’ll learn how to make decisions using conditional statements.

© 2025 Techverse by Vijay | Learn Python

Comments

Popular posts from this blog

Making the Chatbot Smarter with OpenAI API and Machine Learning

Building Your First AI Chatbot with Python.

Essential VS Code Extensions