2
1

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で言語処理100本ノック2015 問題02

Last updated at Posted at 2017-11-12

自然言語処理100本ノック挑戦中です。
早速3問目いきましょう!

問題02:「パトカー」+「タクシー」の文字を先頭から交互に連結して文字列「パタトクカシーー」を得よ.

#解答

Python3
s1 = 'パトカー'
s2 = 'タクシー'
ans = ''

for i,j in zip(s1,s2):
    ans +=  i + j

print(ans)
実行結果
パタトクカシーー

#参考
すぐに上記の実装に至ったのですが他のやり方など調べているとなんと100本ノックで自分の100倍しっかりした記事を書いている方がいました。笑
https://qiita.com/segavvy/items/725b20f21951975a06fd

以上です!

2
1
0

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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?