You are on page 1of 2

MIS 301 Programming Assignment 3

Code:

def change_character(character):
# create strings of vowel letter
lower_vowel = 'aeiou'
upper_vowel = 'AEIOU'

#if the character is a lower vowel letter


if character in lower_vowel:
print('egg' + character, end='')

#if the character is an upper vowel


elif character in upper_vowel:
print('Idig' + character, end='')

#if the character is not a vowel letter


else:
print(character, end='')

def main():
with open('english_text.txt') as file:
lines = file.readlines()
#iterate over all lines of the text
for line in lines:

#iterate over all words in the line


for word in line.split():
#iterate over all characters in the word
for character in word:
change_character(character)

print(" ", end="")

print()
main()
Picture of code:

Result:

You might also like