1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Semmy [17]
4 years ago
8

Write a program that takes nouns and forms their plurals on the basis of these rules:

Computers and Technology
1 answer:
soldi70 [24.7K]4 years ago
4 0

Answer:

def nounToplural(tex):

   import re

   

   text = tex.split()

   new = []

   for word in text:

       if re.findall(r"y\b", word):

           word = re.sub(r"y\b", 'ies' ,word)

           new.append(word)

       

       elif re.findall(r"ch\b", word):

           word = re.sub(r"ch\b", 'ches' ,word)

           new.append(word)

       elif re.findall(r"sh\b", word):

           word = re.sub(r"sh\b", 'shes' ,word)

           new.append(word)

       elif re.findall(r"s\b", word):

           word = re.sub(r"s\b", 'ses' ,word)

           new.append(word)

       else:

           word = word + 's'

           new.append(word)

   result = []

   for i in text:

       for j in new:

           if new.index(j) == text.index(i):

               result.append( (i,j) )

           

           

   print(result)

str = "chair dairy boss circuis fly dog church clue dish"

nounToplural(str)

Explanation:

We made use or Regular Expressions which is simply a special sequence of characters that helps you match or find other strings or sets of strings, by using a specialized syntax held in a pattern.

Firstly, define the function and import the regular expression module, split the text into a list and create an empty list to hold the plural list.

For every word in the list  we check with IF statements and regular expressions to find out what they end with.

 if re.findall(r"y\b", word):

           word = re.sub(r"y\b", 'ies' ,word)

           new.append(word)

The above IF block checks if a noun ends with 'y', if it does it replaces the 'y' with 'ies' and ads it to the new list.

If it does not, ot moves to the next IF/ELIF block.

In the ELIF blocks carry out a  a similar operation for "s", "ch", or "sh", in order to add "es".

Finally, 's' is added to all other cases using the ELSE block which traps any noun that did not fall under the IF or any of the ELIF blocks.

This last part of the code prints both list side by side and passes them to a new list result which is printed to the screen

<em>result = [] </em>

<em>    for i in text: </em>

<em>        for j in new: </em>

<em>            if new.index(j) == text.index(i): </em>

<em>                result.append( (i,j) ) </em>

<em>             </em>

<em>             </em>

<em>    print(result)</em>

I called the function and passed the string you provided in your question and attached the result of the code.

You might be interested in
A company wishes to move all of its services and applications to a cloud provider but wants to maintain full control of the depl
Brrunno [24]

Answer:

b. IaaS  Infrastructure as a Service

Explanation:

  • Infrastructure as a Service is a cloud infrastructure service or platform which provides with the computing resources like servers, storage services, backup service and networking services.
  • These services are provided to the organizations by cloud service providers to fulfill their business and resources requirements and the users have to purchase these services.
  • These resources and services are provided from the data centers of the cloud service providers.
  • It is beneficial to utilize these virtual services from a third party provider  than to buy the hardware equipment and the consumers can use these services as per their needs and are charged accordingly instead of purchasing their own hardware which often gets difficult to maintain.
  • These services also provide and manage the operating systems, the applications and provides with the backup services, internet connection, security such as firewall and access controls and manage storage such as hard drives. Users can install and run any applications.
  • Iaas offers scalability as it can add resources and services with the growing requirements of the users.
4 0
3 years ago
Identify one type of business or organization that you believe would have serious risks if they chose to use VLANs and/or VPNs.
german

Answer:

National security agency

Explanation:

A lot of the private VPNs are own by corporations outside the USA, a national security agency is constantly sending sensitive and priceless data over the internet, when you decide to use a VPN it is possible for the service provider to share the decrypted information with others, therefore, if the national security agency at issue decide to use the service of an unscrupulous VPN provider their sensitive information could end in the hands of a foreign government who is willing to pay a lot for the data.

Note: there could be a case in which the VPN service provider is not corrupted, but the government forces them to share the information through legal actions.

5 0
4 years ago
Problems and Exercises 16 through 43 are based on the entire ("big" version) Pine Valley Furniture Company database. Note: Depen
lesya [120]

Answer:

SQL queries

The command used to display the customer ID and total number of orders placed is given below

Query:

SELECT CustomerID, COUNT (orderID) AS TotalOrders

FROM Order_Table

GROUP BY CustomerID

Explanation:

SQL queries

The command used to display the customer ID and total number of orders placed is given below

Query:

SELECT CustomerID, COUNT (orderID) AS TotalOrders

FROM Order_Table

GROUP BY CustomerID

SELECT - To query the database and get back the specified fields SQL uses the select statement

CustomerID is a coloumn name

The function COUNT(OrderID) returns the number of orders

Totalorderds is a label

FROM - To query the database and get back the preferred information by specifying the table name

Order_Table is a table name

GROUP BY - The clause is used to group the result of a SELECT statement done on a table where the tuple values are similar for more than one column

The table below displays the CustomerID and total number of orders placed

CustomerID                                              Totalorders

4                                                                    28

1                                                                      6

12                                                                    5

16                                                                    5

6                                                                     3

9                                                                     3

15                                                                    3

3                                                                     1

13                                                                    1

14                                                                    1

The table below shows the total number of orders situated for each sales person

SalesPerson_ID                                         TotalOrders

3                                                                    16

2                                                                     3

4                                                                     3

5                                                                     3

3 0
3 years ago
Every file on a storage device has a _______. (a.) name (b.) size (c.)both of the above (d.) none of the above
zmey [24]
The correct answer is: C: both of the above, i. e. name and size.
8 0
3 years ago
Write a method named quarterstodollars. the method should accept an int argument that is a number of quarters, and return the eq
enyata [817]
 public static void quarterstodollars(String[] args) {    Scanner input = new Scanner(System.in);    System.out.println("Enter number of Quarters:");
    System.out.print("Quarters:");    int Q1 = input.nextInt();
DecimalFormat fmt = new DecimalFormat("$#,###.##");    System.out.println("Total:"+fmt.format(calctotal(Q1)));}public static double calctotal(int Q1) {    double total;    total=(0.25 * Q1);    return (total);}

Hope this helps!
7 0
4 years ago
Read 2 more answers
Other questions:
  • When you hear or see the warning signal of any emergency vehicle, you should ________________.?
    14·1 answer
  • What type of program installs and gathers personal information, including password and account information, from a computer with
    9·1 answer
  • so im doing this school challenge and the teachers said whats the average text a student gets a day so i need to get about 20 in
    13·2 answers
  • A) Suppose a computer has an instruction pipeline with 4 phases. How many cycles (if there are no delays) would it take to compl
    13·1 answer
  • Cerința
    6·1 answer
  • All the following are the basis of the World Wide Web except:
    14·2 answers
  • Serting a header at the top of a page will make it appear on_____. ?
    13·1 answer
  • Why were Redditors interested in "Mister Splashy Pants"?
    6·2 answers
  • Anyone wanna talk im 13 eboy single
    11·2 answers
  • In object-oriented analysis, an object is a member of a(n) _____, which is a collection of similar objects.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!