From a555902687e53e21e5f05f0b487d8a89449773e0 Mon Sep 17 00:00:00 2001 From: Tiago Saraiva Date: Tue, 16 Jan 2024 14:55:20 -0600 Subject: [PATCH] Vowels exercise with a list --- HeadFirstPython/Chapter2/vowels.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 HeadFirstPython/Chapter2/vowels.py diff --git a/HeadFirstPython/Chapter2/vowels.py b/HeadFirstPython/Chapter2/vowels.py new file mode 100644 index 0000000..fd4cb72 --- /dev/null +++ b/HeadFirstPython/Chapter2/vowels.py @@ -0,0 +1,24 @@ +""" +Book Head First Python, chapter 2, example, page 56 + +@author: tiago +@date: Jan 24 +""" +vowels = ['a', 'e', 'i', 'o', 'u'] +word = "Milliways" + +for letter in word: + if letter in vowels: + print(letter) + +found = [] +print(len(found)) +found.append('a') +print(len(found)) +print(found) +found.append('e') +found.append('i') +found.append('o') +print(len(found)) +print(found) +