-
-
Save LarynQi/e64bed1920bfe3d35b2f6c30ead8033e to your computer and use it in GitHub Desktop.
CS61A SU20 Quiz 1.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import doctest | |
# To check your work, run the following command: | |
# python3 quiz1.4.py -v | |
def reverse_digits(n): | |
"""Given a positive integer n, reverse its digits. | |
Do not use strings. | |
>>> d1 = 12345 | |
>>> reverse_digits(d1) | |
54321 | |
>>> d2 = 101 | |
>>> reverse_digits(d2) | |
101 | |
>>> d3 = 100 | |
>>> reverse_digits(d3) | |
1 | |
""" | |
result = _________ | |
_______________: | |
_____________________________ | |
_____________________________ | |
return _________ | |
doctest.testmod() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment