🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

नीचे दिए गए कोड स्निपेट में var का डेटाटाइप क्या होगा?

What will be the datatype of the var in the below code snippet?

var = 10
print(type(var))
var = "Hello"
print(type(var))

A)
B)
C)
D)

Explanation:

In the given code snippet:

  1. var = 10: Initially, var is assigned the value 10, which is an integer, so its type is int.
  2. var = "Hello": Then, var is assigned the value "Hello", which is a string, so its type becomes str.

Thus, the data type of var changes from int to str as the value is reassigned.

Correct answer: (D) int and str.

Latest Updates