Posts

Showing posts with the label and more.

Python Data Types - Beginner Python Notes By Mr. Bilred - TechAmbitionX

Image
Python Data Types — What’s Inside the Box? | TechAmbitionX Python Data Types — What’s Inside the Box? So you’ve got a variable, like x = 5 Cool, but what type of thing is that? In Python, every value has a data type . Think of it like the kind of stuff inside the box. Common Python Data Types Integer (int): Whole numbers age = 21 Float: Decimal numbers pi = 3.14 String (str): Text name = "Bilal" Boolean (bool): True or False is_alive = True List: Collection of items fruits = ["apple", "banana", "cherry"] Dictionary (dict): Key-value pairs user = {"name": "Bilal", "age": 21} NoneType: Represents nothing result = None And remember, List have Square Brackets, And dictionary have Curly braces How to Check Data Type You can check what type something is using the type() function: print(type(...