answer.
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
N76
2 months 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:
Viktor [391]2 months ago
7 0

Answer:

The Python code is provided below with suitable comments

Explanation:

# convert list to set

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

# get name for removal and addition from user

remove_name = input("Enter remove name: ")

add_name = input("Enter add name: ")

# remove specified name from set

male_names.remove(remove_name)

# add new name to set

male_names.add(add_name)

# sort the resulting set

a = sorted(male_names)

# output the sorted set

print(a)

You might be interested in
Number pattern Write a recursive method called print Pattern() to output the following number pattern. Given a positive integer
alex41 [359]

Response:

Refer to the explanation

Clarification:

Code:

import java.util.Scanner;

public class NumberPattern {

public static int x, count;

public static void displayNumPattern(int num1, int num2) {

if (num1 > 0 && x == 0) {

System.out.print(num1 + " ");

count++;

displayNumPattern(num1 - num2, num2);

} else {

x = 1;

if (count >= 0) {

System.out.print(num1 + " ");

count--;

if (count < 0) {

System.exit(0);

}

displayNumPattern(num1 + num2, num2);

}

}

}

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

int num1;

int num2;

num1 = scnr.nextInt();

num2 = scnr.nextInt();

displayNumPattern(num1, num2);

}

}

See attached example output

3 0
1 month ago
Read 2 more answers
Consider the following program:
Daniel [329]

Answer:

The resolution for this question is below in the explanation section.

Explanation:

The right response to this question is A, which is 112002.

The correct code relating to this question is presented below

#include  <stdio.h>

#include  <string.h>

#include  <sys/types.h>

//#include "csapp.h"

void end(void)

{

printf("2");

}

int main()

{

if (fork() == 0)

atexit(end);

if (fork() == 0)

printf("0");

else

printf("1");

exit(0);

}

/* $end forkprob2 */

When this program is executed, the fork function will yield varying results.

However, it should be noted that running it multiple times will produce inconsistent values. The most common output the program will generate is A.

Attached is an image of the program's execution for further clarification.

5 0
11 days ago
A well-insulated rigid tank contains 1.5 kg of a saturated liquid–vapor mixture of water at 200 kPa. Initially, three-quarters o
Daniel [329]

Answer:

The change in entropy of the steam is 2.673 kJ/K

Explanation:

The mass of the liquid-vapor mixture is 1.5 kg

The mass in the liquid phase is calculated as 3/4 × 1.5 kg = 1.125 kg

The mass in the vapor phase is calculated as 1.5 - 1.125 = 0.375 kg

According to the steam tables

At a pressure of 200 kPa (200/100 = 2 bar), the specific entropy of steam is found to be 7.127 kJ/kgK

The entropy of steam can be calculated as specific entropy multiplied by mass = 7.127 × 0.375 = 2.673 kJ/K

6 0
25 days ago
Read 2 more answers
Suppose we include the lead resistance in the calculation of temperature for a class A RTD. If R3 = 1000 ohms, Ra = 18 ohms, V0
alex41 [359]

Respuesta:

La temperatura máxima que se puede medir (en °C) es 14170.27°C

Explicación:

Los RTDs son termómetros compuestos de metales cuya resistencia aumenta con la temperatura.

Para un RTD de Clase A, l, Alpha = 0.00385.

La fórmula para el RTD es

Rt = Ro ( 1 + alpha x t)

Donde

Rt es la resistencia a la temperatura t°C,

Ro es la resistencia a 0°C

Alpha es un coeficiente de temperatura constante para un RTD de clase A.

Aquí, Rt = 1000ohms,

Ro se considera como Ra = 18Ohms

Por lo tanto,

1000 = 18 ( 1 + 0.00385t)

Dividiendo ambos lados por 18

1 + 0.00385t = 1000/18

0.00385t = 55.55 - 1

0.00385t = 54.55

t = 54.55/0.00385

t = 14170.27°C

5 0
11 days ago
An open vat in a food processing plant contains 500 L of water at 20°C and atmospheric pressure. If the water is heated to 80°C,
Mrrafil [318]

Answer:

Volume change percentage is 2.60%

Water level increase is 4.138 mm

Explanation:

Provided data

Water volume V = 500 L

Initial temperature T1 = 20°C

Final temperature T2 = 80°C

Diameter of the vat = 2 m

Objective

We aim to determine percentage change in volume and the rise in water level.

Solution

We will apply the bulk modulus equation, which relates the change in pressure to the change in volume.

It can similarly relate to density changes.

Thus,

E = -\frac{dp}{dV/V}................1

And -\frac{dV}{V} = \frac{d\rho}{\rho}............2

Here, ρ denotes density. The density at 20°C = 998 kg/m³.

The density at 80°C = 972 kg/m³.

Plugging in these values into equation 2 gives

-\frac{dV}{V} = \frac{d\rho}{\rho}

-\frac{dV}{500*10^{-3} } = \frac{972-998}{998}

dV = 0.0130 m³

Therefore, the percentage change in volume will be

dV % = -\frac{dV}{V}  × 100

dV % = -\frac{0.0130}{500*10^{-3} }  × 100

dV % = 2.60 %

Hence, the percentage change in volume is 2.60%

Initial volume v1 = \frac{\pi }{4} *d^2*l(i)................3

Final volume v2 = \frac{\pi }{4} *d^2*l(f)................4

From equations 3 and 4, subtract v1 from v2.

v2 - v1 =  \frac{\pi }{4} *d^2*(l(f)-l(i))

dV = \frac{\pi }{4} *d^2*dl

Substituting all values yields

0.0130 = \frac{\pi }{4} *2^2*dl

Thus, dl = 0.004138 m.

Consequently, the water level rises by 4.138 mm.

8 0
1 month ago
Other questions:
  • A Carnot heat engine receives heat from a reservoir at 900oC at a rate of 800 kJ/min and rejects the waste heat to the ambient a
    13·1 answer
  • Your employer has the ability to protect you from cave-ins and other hazards by using adequately-designed protection systems in
    13·1 answer
  • 3.24 Program: Drawing a half arrow (Java) This program outputs a downwards facing arrow composed of a rectangle and a right tria
    12·1 answer
  • The basic barometer can be used to measure the height of a building. If the barometric readings at the top and the bottom of a b
    15·1 answer
  • A pipe in a district heating network is transporting over-pressurized hot water (10 atm) at a mass flow of 0.5 kg/s. The pipe is
    14·1 answer
  • You want to determine whether the race of the defendant has an impact on jury verdicts. You assign participants to watch a trial
    9·1 answer
  • Consider a rectangular fin that is used to cool a motorcycle engine. The fin is 0.15m long and at a temperature of 250C, while t
    5·1 answer
  • Michelle is the general manager of a power plant. This morning, she will meet with city officials to discuss environmental issue
    5·1 answer
  • An inventor claims to have devised a cyclical engine for use in space vehicles that operates with a nuclear fuel generated energ
    14·1 answer
  • 1. Consider a city of 10 square kilometers. A macro cellular system design divides the city up into square cells of 1 square kil
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!