Python

Types of Variables, Assigning, declaring and deleting variables.

Types of variables

There are two types of variables in python  local and global variables.

•     In Python, global variable is a variable declared outside of the function or in global scope.

•    global variable can be accessed inside or outside of the scope  function

Local variables

Local variables are the variables that are used with in a function or method.

Global variables

Global variables are used when we use the variable in the entire program.

Assigning values to variables

•  Python allows us to assign values to the variables.

• Lets assume the value 5 is assigned to the variable ‘a’

Multiple assignment

• In multiple assignment , multiple variables are assigned with multiple values.

Example

Declaring and re-declaring the variables.

•  Lets first see how to declare a variable. Its that simple that assigning variable a value to hold.

Example

>>> a=9

>>> print(a)

9

Now we re declare the variable.

   a=9

print(a)

a= 33

print(a)

output:

33

Here the output gives the re assigned value instead of first value. This means that the first value is replaced by second  value.

Deleting the variable

• In python you can delete the variable that you  previously assigned  the value using del command.

Example

a=7

print(a)

del a

print(a)

Lakshmi Durga

Share
Published by
Lakshmi Durga

Recent Posts

Samsung TV Red Light Blinking? 4 Fixes (2026 Power Logic Hub)

User Problem Scenario: The Red Light "Panic" You press the power button on your Samsung…

5 days ago

Samsung TV Not Connecting to WiFi: 2026 Easy Fix Guide

Introduction: I Know the Feeling "We’ve all been there. You sit down to watch your…

6 days ago

Samsung TV Restarting During Diagnosis? Fix the Reboot Loop Fast

User Problem Scenario: The "Diagnosis Loop" Paradox Imagine you notice your apps are slow. You…

6 days ago

Samsung TV Optimize Now Not Working? (2026 Fix: Greyed Out, Stuck or Not Responding)

🎓 Technical Module: Memory Maintenance Logic Module: WV-OS-307 Verified 2026 👨‍🏫 Instructor: Vangari Divya (M.Tech)…

1 week ago

Samsung Smart Hub Test Failed? (2026 Fix: DNS, ISP Block & Authentication Error)

 Introduction: The Setup Paradox "There is a specific moment of frustration for every Samsung Smart…

2 weeks ago

Samsung TV Picture Test Not Working? 4 Technical Recovery Fixes

Introduction: Lab Diary & Experience "When your Samsung TV screen begins to flicker or show…

2 weeks ago