Created
August 11, 2020 12:26
-
-
Save zimolzak/bddfc0771d5b60e24d7fb5d9980bf115 to your computer and use it in GitHub Desktop.
Make string with specified number of dots, in rows of 10. Useful to show a toddler which is the bigger number.
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
def arrange_dots(number): | |
"""Make string with specified number of dots, in rows of 10. | |
Useful to show a toddler which is the bigger number. | |
""" | |
tens = number // 10 | |
ones = number % 10 | |
row_of_ten = '.' * 10 + '\n' | |
rectangle = '\n' + row_of_ten * tens | |
return(rectangle + '.' * ones) | |
if __name__ == '__main__': | |
print(arrange_dots(72)) | |
print(arrange_dots(56)) | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment