Get answer of your all questions and doubts! ➤
Question
What are three internal key-attributes of a value-variable in Python? Explain with example.
[Computer Science Class – 11 Sumita Arora solutions. Chapter 6 – Data Handling.]
Answer
Three internal key-attributes of a value-variable in Python are:
- Type
- Value
- Id
For example:
a = 9
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 9 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)
Related Questions:
- What will the result given by the following? (a) type (6+3) (b) type (6-3) (c) type (6*3) (d) type (6/3) (e) type (6//3) (f) type (6%3)
- How are these numbers different from one another? 33, 33.0, 33j, 33+j
- The complex numbers have two parts: real and imaginary. In which data type are real and imaginary parts represented?
- How many integer types are supported by Python? Name them.
- Ask or look other questions and answers.