Skip to content

Instantly share code, notes, and snippets.

@peacock0803sz
Last active April 29, 2020 03:27
Show Gist options
  • Save peacock0803sz/ec695ccba42945db3e04ad92cc152aad to your computer and use it in GitHub Desktop.
Save peacock0803sz/ec695ccba42945db3e04ad92cc152aad to your computer and use it in GitHub Desktop.
from random import choice
from typing import Generator
ZUN = "ズン"
DOKO = "ドコ"
KIYOSHI = "キ・ヨ・シ!"
def generate_stream() -> Generator[str, None, None]:
while True:
print(which := choice([ZUN, DOKO]), end="")
yield which
def main():
stream = []
while not (stream[-6:] == [DOKO] + [ZUN] * 4 + [DOKO]):
stream.append(next(generate_stream()))
print(KIYOSHI)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment