Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q13 of 15
Python - Variables and Dynamic Typing
What will be the output of this code?
value = 3.14
print(type(value))
A<class 'float'>
B<class 'int'>
C<class 'str'>
DError
Step-by-Step Solution
Solution:
  1. Step 1: Identify the data type of value

    The variable value is assigned 3.14, which is a decimal number, so its type is float.
  2. Step 2: Understand what print(type(value)) outputs

    The type() function returns <class 'float'> for a float value, which is printed.
  3. Final Answer:

    <class 'float'> -> Option A
  4. Quick Check:

    3.14 is float type [OK]
Quick Trick: Decimals are float type in Python [OK]
Common Mistakes:
MISTAKES
  • Confusing float with int
  • Expecting string output
  • Thinking it causes an error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes