Computer Science

What are three internal key-attributes of a value-variable in Python ? Explain with example.

Python Data Handling

55 Likes

Answer

The three internal key-attributes of a value-variable in Python are:

  1. Type
  2. Value
  3. Id

For example, consider this:

a = 4

The type of a is int which can be found with the built-in function type() like this:
type(a).

Value can be found using the built-in function print() like this:
print(a)

It will give the output as 4 which is value contained in variable a.

Id is the memory location of the object which can be determined using built-in function id() like this:
id(a)

Answered By

32 Likes


Related Questions