Python Declare any variable without assigning any value

Here, we will figure out how to proclaim any factor without allotting any an incentive in Python?

Since Python is a powerful programming language so there is no compelling reason to pronounce such sort of factor, it naturally announces when first-time esteem relegates in it.

In any case, this is a typical inquiry posed by numerous software engineers that would we be able to pronounce any factor with no worth?

The appropriate response is: “Yes! We can announce such sort of factor”. To announce a variable with no factor, simply relegate None.

Program

# Python program to declare a 
# variable without assigning any value 

# declare variable 
num = None

# print the value
print "value of num: ", num

# checking variable
if (num==None):
	print "Nothing"
else:	
	print "Something"
	
# assign some value
num = 100

# print the value
print "value of num: ", num

# checking variable
if (num==None):
	print "Nothing"
else:	
	print "Something"

Output

 value of num:  None
    Nothing
    value of num:  100
    Something

Leave a Comment

error: Alert: Content is protected!!