1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ズンドコキヨシ:Pythonで簡単に実装篇

1
Posted at

はじめに

やりたいことが特に思いつかなかったのですが、無性にプログラミングがしたくなったところ、友人にズンドコキヨシやってみたらと言われたのでやってみました。
めっちゃ簡単に実装してます。
ワンライナーとか挑戦してみたかったのですが、自分の頭じゃ思いつかなかったので。

実装

zunndoko.py
# -*- coding: utf-8 -*-
import random

zundoko = list(map(str, range(5)))
while ''.join(zundoko) != 'ズンズンズンズンドコ':
    del zundoko[0]
    zun = random.choice(['ズン','ドコ'])
    print(zun, end='')
    zundoko.append(zun)

print('キ・ヨ・シ!')

出力

ズンズンドコズンズンズンズンドコキ・ヨ・シ!
1
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?