Python Interviews: Difference between revisions
no edit summary
No edit summary |
No edit summary |
||
Line 1:
= Modulus Operator =
* Check whether a number is divisible by another number using the modulus operator, %
Line 9 ⟶ 11:
print(i.strip('\n'))
[x**2 for x in range(1,11) if x % 2 == 1]
[x for x in range(1,11) if x % 2 == 0]
[start : stop : steps]
= Floor Division =
* Floor Division operator used for dividing two operands with the result as quotient showing only digits before the decimal point:
10//5 = 2
|