Question: I already completed Part 1 and here is the code: def main(): #Array singular=[] plural=[] #loop that will continuously prompt for user input while True:

I already completed Part 1 and here is the code:

def main():

#Array

singular=[]

plural=[]

#loop that will continuously prompt for user input

while True:

print(' ')

word =str(input("Enter a word to find the plural form or x to exit: ")).lower()

if word != 'x':

singular.append(word)

if word == 'x':

for i in range(len(singular)):

print(singular[i]+ '\t'+ plural[i])

print('###The program has ended###')

break

#create pluralizatiomn algorithm

#first rule of pluralization

if word[-1]== 'f':

word = word[:-1] + 'ves'

print(word)

elif word[-2]== 'f' and word[-1]=='e':

word = word[:-2] + 'ves'

print(word)

#second rule of pluralization

elif word[-2]== 'u' and word[-1]== 's':

word = word[:-2] + 'i'

print(word)

#third rule of pluralization

elif word[-1]== 'y':

word = word[:-1] + 'ies'

print(word)

#fourth rule of pluralization

elif word[-1]== 'z' or 'x' or 'o':

word += 'es'

print(word)

elif word[-2]== 's' or 'c' and word[-1]=='h':

word += 'es'

print(word)

#fifth rule of pluralization

elif word[-2]== 'on':

word = word[:-2] + 'a'

print(word)

#sixth rule of pluralization

else:

word += 's'

print(word)

#print the output

plural.append(word)

main()

Complete Part 1

-Instead of inputting a word, input the file provided in the assignment.

-The file includes both the singular noun and the expected plural.

  • The file is a comma-separated value (CSV) file.
  • If you have trouble opening the file try: open("proj3.csv",encoding='utf8')

-Create a try-except for the input file

-Output to a file the input, your output, and the expected output.

-Include the percentage of how many correct outputs your program made.

Rubric

Goal

Points

Successfully input file

25

Successfully output file

25

Calculate success rate

15

Use try-except for input file

10

Correct use of comments and pseudocode

25

" It has to run in python idle shell"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!