Are you ready?
1 questions to solve.
- This quiz goes to full-screen once you press the Start button.
- At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
Python has two different classes for integers and floats. True or false?
Yes, Python indeed has two different classes for integers and floats. The
intclass represents integers while the
floatclass represents floats. See more at Python Number Basics.
3 // 2return?
//operator computes floor division. That is, it performs normal division and then floors the result. So
3 // 2returns
1, which goes with choice (A). Read more at Python Number Basics — floor division.
4 / 2return?
/division operator in Python returns a float, even if the result is an integer. Therefore
4 / 2returns
2. This goes with choice (B). More details at Python Number Basics.
esymbol in numbers denotes scientific notation. The number preceding it represents the significand while the number following it represents the order of magnitude (the power of
10). Moreover, it returns a float.
1e3represents the number
1000.0, which goes with choice (D). See more at Python Number Basics — the
type()function takes in a given value and returns back the class that represents it.
type(10), likewise, returns back the class
10is an integer in Python belonging to the class
int. For more details, refer to Python Number Basics — integers.
When called without an argument,
0. Hence, the correct choice is (A).
How to check if a float
frepresents an integer i.e has a fractional part equal to
We can call
f.is_integer()to see if the float
frepresents an integer. It would return
Trueon integer floats such
Falseotherwise. See more at Python Number Basics —
What is the difference b/w the
**exponentiation operator and the
pow()function additionally enables one to perform fast modular exponentiation, by providing a third, optional argument. Hence the correct choice is (B). For a comprehensive discussion on the difference b/w
pow(), refer to Python Number Basics — difference between
3e100000resolve down to?
3e100000represents an extremely large float, that can't be held on in Python's double-precision format. Python evaluates it to
infi.e infinity. Hence, the correct choice is (A). For more details, refer to Python Number Basics — floats.