Last active
August 30, 2023 09:08
-
-
Save nitori/e9704b249526296c1e5701cd9822cbf7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 sys | |
| def int_succeeds(c: str): | |
| try: | |
| int(c) | |
| except ValueError: | |
| return False | |
| return True | |
| chars = [chr(n) for n in range(sys.maxunicode + 1)] | |
| numerics = {c for c in chars if c.isnumeric()} | |
| digits = {c for c in chars if c.isdigit()} | |
| decimals = {c for c in chars if c.isdecimal()} | |
| print('No. numerics:', len(numerics)) | |
| print('No. digits:', len(digits)) | |
| print('No. decimals:', len(decimals)) | |
| print('numerics \N{SUPERSET OF} digits \N{SUPERSET OF} decimals:', numerics > digits > decimals) | |
| print('int() on all numerics:', all(int_succeeds(c) for c in numerics)) | |
| print('int() on all digits:', all(int_succeeds(c) for c in digits)) | |
| print('int() on all decimals:', all(int_succeeds(c) for c in decimals)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment