We fixed justvowels so that it works with lowercase or uppercase vowels. Fix notvowels so that it doesn’t print out uppercase vowels. (Try it as it is in the chapter, and you will see that it does print uppercase vowels, even though the function is supposed to only print not vowels.) Actually, do two versions of notvowels, using each of the two methods that we used to fix justvowels.

1. Explicitly checking for uppercase vowels:
2. Using the string method “lower()”:


1. ```
def notvowels(string):
for letter in string:
if not (letter in "aeiouAEIOU"):
print letter
```
2. ```
def notvowels(string):
for letter in string:
if not letter.lower() in "aeiou": print letter
```

Note: This version does not explicitly check for consonants, but just if a character is not a vowel. One could instead remove the “not” and check against “qwrtypsdfghjklzxcvbnmQWRTYPSDFGHJKLZXCVBNM” and “qwrtypsdfghjklzxcvbnm” or some variation thereof.

Computer Science & Information Technology

You might also like to view...

Which of the following statements is false?

a. A finally block is placed after the last catch block. b. A finally block typically releases resources acquired in the corresponding try block. c. The finally block and try block can appear in any order. d. A finally block is optional.

Computer Science & Information Technology

The Windows ________ utility looks for files that can safely be deleted to free up disk space

A) Error Checking B) Optimize Drives C) Space Manager D) Disk Cleanup

Computer Science & Information Technology

Which of the following is not true when viewing events collected by an IPAM server?

A. events related to DHCP scope changes can be viewed B. events in the detail pane can be clicked for more information C. events are visible in real time D. events related to DHCP policies changes can be viewed

Computer Science & Information Technology

Since data transmissions can pass through fiber-optic cable in only one direction, at least two fibers are required to enable transmission of data in both directions.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology