Variables in Python

Variables in Python

Table of Contents

Introduction

Variables in python are basically reserved memory locations to store some values that are likely to change. While Python is a completely object-oriented language, all variables in Python are objects.

Python doesn’t require variables to be explicitly declared, rather declaration occurs when a value is assigned to a variable. The assignment operator (=) is used to assign a value to a variable.

Examples of Variables in Python

a = 10           # integer value assigned to a variable                  
name = "Joker"   # string value assigned to name variable
p = q = r = 20   # multiple assignment

In the above code, variables ‘a’ and ‘name’ are assigned values 10 and Joker respectively. Python also supports multiple assignments i.e., assigning single values to multiple variables.

Find More on Python Here

Leave a Comment

Your email address will not be published. Required fields are marked *