class A(int):
def __add__(self, value):
return int(str(self) + str(value))
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
""" | |
Compute and display the Earth-Mars distance in light-seconds, light-minutes | |
and kilometers. | |
The easiest way is to install both ``skyfield`` & ``skyfield-data`` to compute | |
this: | |
$ pip install skyfield skyfield-data | |
You can also install `skyfield` only, but it'll force you to download the |
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 shortenize(words: str): | |
""" | |
>>> shortenize("Causses et Vallée de la Dordogne") | |
"Cauvaldor" | |
""" |
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
class Bee: | |
def __str__(self): | |
return "🐝" | |
class Dog: | |
def stepped_on(self, something): | |
... | |
if isinstance(something, Bee): | |
raise SystemExit("😱🥴") |
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 random | |
import rich | |
emojis = ( | |
":nerd_face:", | |
":scream:", | |
":smile:", | |
":sunglasses:", | |
":thinking_face:", |
OlderNewer