لَآ إِلَـٰهَ إِلَّا هُوَ
LA ILAHA ILLA HU
Allah, Your Lord There Is No Deity Except Him.

Lesson 2: Variables In Python Coding

Variables are containers for storing data values. Python has no command for declaring a variable. A variable is created the moment you first assign a value to it.

In other words Python variables do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable.

Python Code For Type Variables

the output will be

25

Tom

You can type/copy paste the above code in any online
compiler or editor or you can even practice to write the
code by hand.

Important to Remember:
Single or Double Quotes do not make a difference.

y = "Tom"

is the same as

Y = 'Tom'

Case-Sensitive:

a = 10

A = "Tom"

print(a)

print(A)

This will create two variables A will not overwrite a.

Important to Note:

In Python a variable name should always start with alphabet and not with nos.

However you can have a number following the alphabetic charrater.

Example:

1A is wrong.

A1 is ok.

Aslo to be noted that space is not allowed between a variable name.

Special charracters other than _ are not allowed.

Exercise 2
Correct the variable name in the box below.

Write the code correctly in the box and check your answer below.

Click Check Answer Button