The modulus, the signum, the greatest integer and the fractional part are all short rules. You will write three of them without the math module, and test them on tricky inputs.
The idea. int(x) cuts off the decimals, which is only for . For a negative that is not whole, is one less than int(x).
Your tasks.
sgn, return , or .greatest, return .frac, return .Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…
With Standard, you also open 4 more problems and 1 Python lab. Everything you have used here stays free, always.