開発環境
- macOS Sierra - Apple (OS)
- Emacs (Text Editor)
- Python 3.6 (プログラミング言語)
Head First Python (Paul Barry (著)、O'Reilly Media)のChapter 3.(Structured Data: Working With Structured Data) の SHARPEN YOUR PENCIL(No. 2578) を取り組んでみる。
SHARPEN YOUR PENCIL(No. 2578)
コード(Emacs)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
vowels = set('aeiou')
# word = input('Provide a word to search for vowels: ')
word = 'abcde'
found = vowels.intersection(set(word))
print(found)
入出力結果(Terminal, IPython)
$ ./vowels3.py
{'e', 'a'}
$
0 コメント:
コメントを投稿