Does a variable have to be declared before it is assign the value True or false in Python?

Answer: False

No, we are not required to declare a variable in Python before using it.
In fact, in Python, it’s not necessary to declare a variable at all.
You can create a variable at the moment when you will be using it.

Let’s see some code:

a = 4
b = 3

sum = a + b
print("The addition of two numbers is :",sum)

The output of the code is

The addition of two numbers is : 7

In the above code, we have used the variable sum without even declaring it.

Facebook
Twitter
LinkedIn
Pinterest

Leave a Reply

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

ABOUT ME !!
Johan William

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

RECENT POSTS

TEST