Question
I'm using the Python language and the Pycharm program. here's the question: The third person singular verb form in English is distinguished by the suffix
I'm using the Python language and the Pycharm program. here's the question:
The third person singular verb form in English is distinguished by the suffix -s, which is added to the stem of the so-called infinitive form. Verbs given in the infinitive form are typically written with to in front, as in to sleep or to walk. Often we simply add the letter s to the infinitive form (as in sleep sleeps and run runs), but in other cases we need to modify the end of the word. Here are some simple rules we could consider:
If the verb ends in y, remove the y and add ies. Example: cry becomes cries. If the verb ends in o, ch, s, sh, or x, add es. Example: push becomes pushes, and hiss becomes hisses.
Otherwise, just add s.
Implement a function singular verb() that takes a verb in its infinitive form (but without to) as an argu- ment and converts it to its third person singular verb form according to the rules above.
You might find the string function endswith helpful here. Suppose the variable name represents the string "Wolfie". Then name.endswith(e) and name.endswith(ie) would both evaluate to True, whereas name.endswith(E) and name.endswith(in) would both evaluate to False.
Examples:
Function Call | Return Value |
singular verb(wax) | waxes |
singular verb(type) | types |
singular verb(go) | goes |
singular verb(play) | plaies |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started