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
Lyrx [107]
3 years ago
15

The following program includes fictional sets of the top 10 male and female baby names for the current year. Write a program tha

t creates: A set all_names that contains all of the top 10 male and all of the top 10 female names. A set neutral_names that contains only names found in both male_names and female_names. A set specific_names that contains only gender specific names. Sample output for all_names: {'Michael', 'Henry', 'Jayden', 'Bailey', 'Lucas', 'Chuck', 'Aiden', 'Khloe', 'Elizabeth', 'Maria', 'Veronica', 'Meghan', 'John', 'Samuel', 'Britney', 'Charlie', 'Kim'} NOTE: Because sets are unordered, they are printed using the sorted() function here for comparison
Computers and Technology
1 answer:
bazaltina [42]3 years ago
4 0

Answer:

Following are the program in the Python Programming Language.

male_names = {'kay', 'Dev', 'Sam', 'Karan', 'Broly', 'Samuel', 'Jayd', 'Lucifer', 'Amenadiel', 'Anmol'}

female_names = {'Kally', 'Megha', 'Lucy', 'Shally', 'Bailey', 'Jayd', 'Anmol', 'Beth', 'Veronica', 'Sam'}

#initialize the union from male_names and female_names

all_names = male_names.union(female_names)

#Initialize the similar names from male_names and female_names  

neutral_names = male_names.intersection(female_names)

#initialize the symmetric_difference from male_names and female_names

specific_names = male_names.symmetric_difference(female_names)

#print the results

print(sorted(all_names))

print(sorted(neutral_names))

print(sorted(specific_names))

<u>Output</u>:

['Amenadiel', 'Anmol', 'Bailey', 'Beth', 'Broly', 'Dev', 'Jayd', 'Kally', 'Karan', 'Lucifer', 'Lucy', 'Megha', 'Sam', 'Samuel', 'Shally', 'Veronica', 'kay']

['Anmol', 'Jayd', 'Sam']

['Amenadiel', 'Bailey', 'Beth', 'Broly', 'Dev', 'Kally', 'Karan', 'Lucifer', 'Lucy', 'Megha', 'Samuel', 'Shally', 'Veronica','kay']

Explanation:

<u>The following are the description of the program</u>.

  • In the above program, firstly we set two list data type variables 'male_names' and 'female_names' and initialize the male and female names in those variables.
  • Then, we set three variables in which we store union, intersection, and symmetric differences and finally print these three variables in a sorted manner.
You might be interested in
100 POINTS
agasfer [191]

Answer:

i'm just a kid ku ku ku ku ku ku ku ku ku ku ku ku

6 0
2 years ago
If you could own a large technology Company, which one would it be and why
Lilit [14]
I would own Apple. Because I would be rich and create apple products
6 0
3 years ago
When you use the Filter feature, what appears in each column label
Scrat [10]
<span>an arrow  ..............................</span>
5 0
3 years ago
Write two statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a slash, and
Montano1993 [528]

Answer:

1/2000

Explanation:

import java.util.Scanner;

public class InputExample {

public static void main(String [] args) {

Scanner scnr = new Scanner(System.in);

System.out.print("Enter birth month and date:");//comment this line if not needed

int birthMonth=scnr.nextInt();

int birthYear=scnr.nextInt();

String output= birthMonth+"/"+birthYear+"\n";

System.out.println(output);

}

}

if using this code the out put should be 1/2000

5 0
2 years ago
Write a program that records high-score data for a fictitious game. the program will ask the user to enter five names, and five
Harman [31]

Scores.cpp

#include <iostream>

#include <string>

using namespace std;

void initializeArrays(string names[], int scores[], int size);

void sortData(string names[], int scores[], int size);

void displayData(const string names[], const int scores[], int size);

int main()

{

   string names[5];

   int scores[5];

   //reading names and scores

   initializeArrays(names, scores, 5);

   //sorting the lists based on score.

   sortData(names, scores, 5);

   //displaying the contents of both arrays

   displayData(names, scores, 5);

 

  return 0;

}

void initializeArrays(string names[], int scores[], int size){

   for(int i=0; i<size; i++){

       cout<<"Enter the name for score #"<<(i+1)<<": ";

       cin >> names[i];

       cout<<"Enter the score for score #"<<(i+1)<<": ";

       cin >> scores[i];

       }

}

void sortData(string names[], int scores[], int size){

   

       int temp = 0;

       string tempStr = "";

       

       for(int i=0; i < size; i++){

               for(int j=1; j < (size-i); j++){

                      //checking max score and sorting based on it.

                       if(scores[j-1]< scores[j]){

                               //swap the elements!

                           //swapping scores

                               temp = scores[j-1];

                               scores[j-1] = scores[j];

                               scores[j]=temp;

                               

                               //swapping names

                               tempStr = names[j-1];

                               names[j-1] = names[j];

                               names[j]=tempStr;

                       }

                       

               }

       }

}

void displayData(const string names[], const int scores[], int size){

   cout<<"Top Scorers:"<<endl;

       //printing the elements up to the size of both arrays.

       for(int i=0; i<size; i++){

           cout<<names[i]<<": "<<scores[i]<<endl;

       }

}

3 0
3 years ago
Other questions:
  • You just turned on a four port Ethernet switch (it hasn’t learned any addresses yet) and connected a host to each port. You send
    8·1 answer
  • The highly advanced decision support feature integrated within an electronic information system would support which activity?
    9·1 answer
  • When ordering a new​ zagflatz, customers must choose the style of three major​ components, each of which has about ten variation
    6·1 answer
  • Suppose you were assigned to develop a logical model of the registration system at a school or college. would you be better off
    9·1 answer
  • What are two advantages of encrypting data stored in the computer system?
    5·1 answer
  • PLEASE HELP SOMEONE!!!!!!!!! WILL GIVE BRAINLIEST!!!!!!!!!!!!!!!!!!!!!!!!! Fill in the blanks.
    15·1 answer
  • What is income?
    10·2 answers
  • File
    10·1 answer
  • In python, Create a conditional expression that evaluates to string "negative" if user_val is less than 0, and "non-negative" ot
    12·1 answer
  • Who's hype for Halo Infinite?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!