Python
Questions and concise answers by subject
By profession
By subject
Types and data structuresQuestions: 2
What does input() return?
A string. Calculations require int() or float(); invalid input can raise ValueError.
When should you use a list versus a dictionary?
A list stores an indexed sequence. A dictionary maps unique keys to values, for example device name → IP.
Error handlingQuestions: 1
Why avoid catching everything with one broad except?
It hides programming bugs. Catch expected exceptions such as ValueError and report them clearly; unexpected failures should remain visible.
