0% found this document useful (0 votes)
21 views1 page

Python Variables and Data Types Guide

The document explains Python variables and data types, highlighting that Python is dynamically typed. It details various data types including int, float, complex, str, bool, list, tuple, set, dict, and NoneType, providing examples and brief explanations for each. This overview serves as a foundational guide for understanding how to store and manipulate data in Python.

Uploaded by

rabyasana
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Python Variables and Data Types Guide

The document explains Python variables and data types, highlighting that Python is dynamically typed. It details various data types including int, float, complex, str, bool, list, tuple, set, dict, and NoneType, providing examples and brief explanations for each. This overview serves as a foundational guide for understanding how to store and manipulate data in Python.

Uploaded by

rabyasana
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python Variables and Data Types

In Python, variables are used to store data values. Python is dynamically typed, meaning
you do not need to declare the type of a variable explicitly. The type is assigned
automatically when a value is stored.

Type Name Example Explanation

int Integer age = 25 Whole numbers,


positive or negative,
without decimals.

float Floating-point pi = 3.1416 Numbers with


decimals, for
scientific/engineeri
ng calculations.

complex Complex number z = 2 + 3j Numbers with real


and imaginary parts.

str String name = "Rabya" Text values inside


quotes (single or
double).

bool Boolean flag = True Logical values: True


or False.

list List (ordered, marks = [85, 90, 78] Collection of items,


mutable) can be changed,
keeps order.

tuple Tuple (ordered, point = (2, 3) Like a list, but


immutable) cannot be changed
once created.

set Set (unordered, items = {1, 2, 3} Unordered


unique) collection with no
duplicates.

dict Dictionary student = {"name": Key–value pairs, like


"Ali", "age": 20} a mini database.

NoneType None x = None Special type


meaning 'no value'.

You might also like