LoginSignup
1
0

More than 3 years have passed since last update.

Pythonで単語のカウント (paizaランク C 相当)を解く

Last updated at Posted at 2020-02-26

初めに

paizaのレベルアップ問題集を解いていたのですが、模範解答がなかったので自分で作ってみました。
言語はPython3です。

問題

Paizaのスキルチェック見本問題 単語のカウント (paizaランク C 相当)
https://paiza.jp/works/mondai/skillcheck_sample/word-count?language_uid=python3
ログインしないと問題文が見れませんでした。
登録は無料ですぐにできるので、とりあえず登録してみることをおススメします。

解答コード

sort-number.py
s = input().split()
word_list = []
for word in s:
    if not word in word_list:
        print(word, s.count(word))
        word_list.append(word)

参考

最後に

分からないところがあれば気軽にコメントしてくださいね。
できるだけ答えますよ!

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