Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- 1.
- Old Mac Donald had a farm, I-A-I-A-O.
- And on his farm he had some chicks, I-A-I-A-O.
- With a chick-chick here, and a chick-chick there,
- here a chick, there a chick ev'rywhere a chick-chick.
- 2.
- Old Mac Donald had a farm, I-A-I-A-O.
- And on his farm he had some ducks, I-A-I-A-O.
- With a quack-quack here, and a quack-quack there,
- here a quack, there a quack ev'rywhere a quack-quack.
- """
- from rich import print
- # linux:
- # pip3 install rich
- # windows:
- # py -3 -m pip install rich
- def print_song(mapping):
- print(mapping["begin"])
- print()
- animals = mapping["animals"].items()
- for animal, sound in animals:
- for line in mapping["text"]:
- print(line.format(animal=animal, sound=sound))
- print()
- end = mapping["end"]
- if end:
- print(end)
- mapping = {
- "begin": "[red]Old Mac Donald had a farm, [green]I-A-I-A-O.",
- "end": "",
- "animals": {"duck": "quack", "chicken": "chick", "dog": "woof",},
- "text": [
- "And on his farm he had some [red blink]{animal}s[/], [green]I-A-I-A-O.",
- "With a [yellow blink]{sound}-{sound}[/] here, and a [yellow blink]{sound}-{sound}[/] there,",
- "here a [yellow blink]{sound}[/], there a [yellow]{sound}[/] ev'rywhere a [yellow blink]{sound}-{sound}.",
- ],
- }
- if __name__ == "__main__":
- print_song(mapping)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement