Problem 5: Min Digit (100pts)
Write a function that takes in a non-negative integer and return its min digit. (Using floor division and modulo might be helpful here!)
def min_digit(x):
"""Return the min digit of x.
>>> min_digit(10)
0
>>> min_digit(4224)
2
>>> min_digit(1234567890)
0
>>> # make sure that you are using return rather than print
>>> a = min_digit(123)
>>> a
1
"""
"*** YOUR CODE HERE ***"
Test your implementation with
python ok -q min_digit
.
Test your code for lab01 with
python ok
, and submit withpython ok --submit
.