Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1(A)Consider the following sentence: “I have had so many strawberries for breakf

ID: 3874697 • Letter: 1

Question

1(A)Consider the following sentence: “I have had so many strawberries for breakfast today.” Write a function that will output how many plural words are in any given sentence.

Example: var sentence = “I have had so many strawberries for breakfast today.”

Plural(sentence) 1

1(B) Write a function that can tell whether numbers in a list are prime or not. The function should output an array that holds the values for if that number in the input array was prime or not.

Example:

            var myArray = [1, 2, 3, 4, 5]

            Prime(myArray) è [false, true, true, false, true]

Explanation / Answer

A)

Replace words wit your sentence

import inflect

inflect = inflect.engine()

english_words = ["hat", "hats"

"mitochondrion", "mitochondria",

"sheep", "a sheep", "the sheep",

"whjkjhkjh", "msipelling"]

count = 0

for en in english_words:

if inflect.singular_noun(en) is True:

count += 1

print(count)

B)

num = int(input("Enter a number: "))  

  

if num > 1:  

for i in range(2,num):  

if (num % i) == 0:  

print(num,"is not a prime number")  

print(i,"times",num//i,"is",num)  

break  

else:  

print(num,"is a prime number")  

else:  

print(num,"is not a prime number")