id/email
password
forgot password
about | help | done | prefs | create account
CodingBat code practice

Python > Logic-1 > near_ten
prev  |  next  |  chance

Given a non-negative number "num", return True if num is within 2 of a multiple of 10. Note: (a % b) is the remainder of dividing a by b, so (7 % 5) is 2.

near_ten(12) → True
near_ten(17) → False
near_ten(19) → True

...Save, Compile, Run

See also Python Example Code. Python help docs: Python Strings | Python Lists | Python If Boolean


prev  |  next  |  chance   |  CodingBat  >  Logic-1

Forget It! -- delete my code for this problem 124.0

Copyright Nick Parlante 2006-10 - privacy