PCEP-30-02 · Question #132
A value returned by the input () function is:
The correct answer is C. a string. Python's input() function always returns a string - even when the user types a number like 42, Python stores it as "42" (text), not a numeric value. This is why option C is correct. Options A and B are wrong because input() performs no automatic type conversion; if you need an…
Question
Options
- Aan integer
- Ba oat
- Ca string
How the community answered
(31 responses)- A16% (5)
- B10% (3)
- C74% (23)
Explanation
Python's input() function always returns a string - even when the user types a number like 42, Python stores it as "42" (text), not a numeric value. This is why option C is correct.
Options A and B are wrong because input() performs no automatic type conversion; if you need an integer or float, you must explicitly wrap the call - int(input()) or float(input()) - otherwise you'll get a string regardless of what the user types.
Memory tip: Think of input() as a mailbox - it collects whatever the user "writes," and writing is always text. You have to open the letter and interpret it yourself (via int() or float()) if you need a number.
Community Discussion
No community discussion yet for this question.