Advertisements
Advertisements
प्रश्न
Is data of different types treated differently in Python? Support your answer with an example.
कोड लेखन
लघु उत्तर
Advertisements
उत्तर
No. Python treats all names uniformly, irrespective of whether they refer to numbers, strings, functions, classes or other objects. A name can refer to only one object at a time.
var = 15
print(var)
var = "Hello" # var is now bound to a string
print(var)
def var(number): # var is now bound to a function
return number * 10
print(var(5))
15
Hello
50
Each new binding replaces the previous binding of var.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
