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
katen-ka-za [31]
3 years ago
6

The top 3 most popular male names of 2017 are Oliver, Declan, and Henry according to babynames. Write a program that modifies th

e male_names set by removing a name and adding a different name. Sample output with inputs: 'Oliver' 'Atlas' { 'Atlas', 'Declan', 'Henry' } NOTE: Because sets are unordered, the order in which the names in male_names appear may differ from above.
Engineering
1 answer:
Flura [38]3 years ago
7 0

Answer:

The code is given below in Python with appropriate comments

Explanation:

# convert list to set

male_names = set(['Oliver','Declan','Henry'])

# get remove and add name from user

remove_name = input("Enter remove name: ")

add_name = input("Enter add name: ")

# remove name from set

male_names.remove(remove_name)

# add new name ij set

male_names.add(add_name)

# sort the set

a = sorted(male_names)

# print the set

print(a)

You might be interested in
An experimentalist claims that, based on his measurements, a heat engine receives 300 Btu of heat from a source of 900 R, conver
lesya [120]

Answer:

Hook's law holds good up to. A elastic limit. B. plastic limit. C.yield point. D.Breaking point

3 0
3 years ago
2. When manipulating your pedals, you should use your
astra-53 [7]

Answer:

D. left foot for the accelerator and your right foot for the brake.

* Hopefully this helps:) mark me the brainliest:)!!

7 0
3 years ago
Read 2 more answers
How does Hydro Technology and Hydro Energy Help with Global Water Issues?
GrogVix [38]
It would have environmental and societal impacts
5 0
3 years ago
It is possible to maintain a pressure of 10 kPa in a condenser that is being cooled by river water entering at 20 °C?
vovangra [49]

Answer:

Yes, it is possible to maintain a pressure of 10 kPa in a condenser that is being cooled by river water that is entering at 20 °C because this temperature (20 °C) of the external cooling water is less than the saturation temperature of steam which is which is 45.81 °C, and heated by a boiler; as a result of this condition, coupled with the assumption that the turbine, pump, and interconnecting tube are adiabatic, and the condenser exchanges its heat with the external cooling river water, it possible to maintain a pressure of 10 kPa.

5 0
4 years ago
You will create an array manipulation program that allows the user to do pretty much whatever they want to an array. When launch
enyata [817]

Answer:

Check the explanation

Explanation:

#include <iostream>

using namespace std;

void insert(int* arr, int* size, int value, int position){

if(position<0 || position>=*size){

cout<<"position is greater than size of the array"<<endl;

return ;

}

*size = *size + 1 ;

for(int i=*size;i>position;i--){

arr[i] = arr[i-1];

}

arr[position] = value ;

}

void print(int arr[], int size){

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

cout<< arr[i] <<" ";

}

cout<<" "<<endl;

}

void remove(int* arr, int* size, int position){

* size = * size - 1 ;

for(int i=position;i<*size;i++){

arr[i] = arr[i+1];

}

}

int count(int arr[], int size, int target){

int total = 0 ;

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

if(arr[i] == target)

total += 1 ;

}

return total ;

}

int main()

{

int size;

cout<<"Enter the initial size of the array:";

cin>>size;

int arr[size],val;

cout<<"Enter the values to fill the array:"<<endl;

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

cin>>val;

arr[i] = val ;

}

int choice = 5,value,position,target ;

do{

cout<<"Make a selection:"<<endl;

cout<<"1) Insert"<<endl;

cout<<"2) Remove"<<endl;

cout<<"3) Count"<<endl;

cout<<"4) Print"<<endl;

cout<<"5) Exit"<<endl;

cout<<"Choice:";

cin>>choice;

switch(choice){

case 1:

cout << "Enter the value:";

cin>>value;

cout << "Enter the position:";

cin>>position;

insert(arr,&size,value,position);

break;

case 2:

cout << "Enter the position:";

cin>>position;

remove(arr,&size,position);

break;

case 3:

cout<<"Enter the target value:";

cin>>target;

cout <<"The number of times "<<target<<" occured in your array is:" <<count(arr,size,target)<<endl;

break;

case 4:

print(arr,size);

break;

case 5:

cout <<"Thank you..."<<endl;

break;

default:

cout << "Invalid choice..."<<endl;

}

}while(choice!=5);

return 0;

}

Kindly check the attached images below for the code output.

3 0
4 years ago
Other questions:
  • . Consider the single-engine light plane described in Prob. 2. If the specific fuel consumption is 0.42 lb of fuel per horsepowe
    9·1 answer
  • A food-services company with a 480 V, three-phase service entrance has the following set of loads:  A 7 ton walk-in refrigerati
    13·1 answer
  • 11 Notează, în caiet, trăsăturile personajelor ce se pot
    13·1 answer
  • Which of the following are all desirable properties of a hydraulic fluid? a. good heat transfer capability, low viscosity, high
    5·1 answer
  • How an AK 47 gun was works​
    14·1 answer
  • Someone claims that the shear stress at the center of a circular pipe during fully developed laminar flow is zero. Do you agree
    12·1 answer
  • What are the initial questions that a systems analyst must answer to build an initial prototype of the system output.
    14·1 answer
  • Some_____
    10·1 answer
  • Determine the output logic-levels(boolean-levels) for XNOR if the two-inputs are inverted?​
    8·1 answer
  • It tells the amount of materials to be purchased.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!