Removing the vowels from a sentence.

★☆☆

Disemvowelling is removing all the vowels from a piece of alphabetic text. It was once a common feature of the SMS language where the number of characters in a message was limited, and users were charged per message. It requires little cognitive effort to read so it was a good way of typing message quickly and keeping the cost down. Disemvowelling has more recently been used as a forum moderation tool.

Disemvowel

Make

Write a program that allows the user to enter a sentence before outputting that sentence with all the vowels removed.

Success Criteria

Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.

Complete the subprogram called dvowel that:

  1. Takes one parameter, message that is the string to process.
  2. Returns the message with all the vowels (AaEeIiOoUu) removed.

Complete the main program so that:

  1. The user can input the message to disemvowel.
  2. The dvowel function is called.
  3. The disemvowelled message is displayed.

Typical inputs and outputs from the program would be:

Enter the message: Hello world
The disemvoweled version of the message is:
Hll wrld
Enter the message: The quick brown fox jumps over the lazy dog
The disemvoweled version of the message is:
Th qck brwn fx jmps vr th lzy dg
🆘 If you're really stuck, use this Parsons code sorting exercise
Complete program
# Disemvowel program

# -------------------------
# Subprograms
# -------------------------
# Remove the vowels from a message
---
def dvowel(message):
---
    dvowelled = message.replace("a", "")
---
    dvowelled = dvowelled.replace("A", "")
    dvowelled = dvowelled.replace("e", "")
    dvowelled = dvowelled.replace("E", "")
    dvowelled = dvowelled.replace("i", "")
    dvowelled = dvowelled.replace("I", "")
    dvowelled = dvowelled.replace("o", "")
    dvowelled = dvowelled.replace("O", "")
    dvowelled = dvowelled.replace("u", "")
    dvowelled = dvowelled.replace("U", "")
---
    return dvowelled
---


# -------------------------
# Main program
# -------------------------
---
message = input("Enter the message: ")
---
print("The disemvoweled version of the message is:")
---
print(dvowel(message))
Alternative program
# Disemvowel program

# -------------------------
# Subprograms
# -------------------------
# Remove the vowels from a message
---
def dvowela(message):
---
    dvowelled = ""
---
    # Consider each character
    for index in range(len(message)):
---
        # Only add the character to the message if it is not a vowel
        if message[index] not in "AaEeIiOoUu":
---
            dvowelled = dvowelled + message[index]
---
    return dvowelled
---


# -------------------------
# Main program
# -------------------------
message = input("Enter the message: ")
print("The disemvoweled version of the message is:")
print(dvowela(message))