Practice question · True or false
In Python, the string '42' and the integer 42 are the same type.
Hints
- Quotation marks change what the value is, not just how it looks.
- Ask whether the two could be compared numerically without conversion.
Show the answer
False
Why
'42' is a str; 42 is an int. They must be converted to compare numerically.
Practise Data representation and basic types
The app has 8 more questions on this lesson, and keeps your place in the course. Physics I is free to start.
More questions on Data representation and basic types
- Order the steps to convert the decimal number 13 to binary.
- In Python, 0.1 + 0.2 == 0.3 is False. What is the root cause?
- A sensor stores readings as 8-bit unsigned integers. How many distinct values can one reading take? Set the…
- In floating point, 0.1 + 0.2 == 0.3 is false. What does that reveal about how numbers are stored?