Creating and modifying sets.
The top 3 most popular male names of 2017 are Oliver, Declan, and Henry according to babynames. Write a program that modifies the 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.
1 male_names = { 'oliver', 'Declan', 'Henry' }
2 name_to_remove = input()
3 name_to_add = input()
4 male_names = { 'oliver', 'Declan', 'Henry' }
5
6 #The statement to remove 'oliver' from the set.
7
8 male_names.remove('oliver')
9
10 #Add the name 'Atlas' in the set ,ale_names.
11
12 male_names.add('Atlas')
13
14 print(male_names)
Testing with inputs: 'Oliver''Atlas'
Your output { 'Atlas', 'Declan', 'Henry' }
Testing with inputs: 'Declan' 'Noah'
Output differs. See highlights below.
Your output { 'Atlas', 'Declan', 'Henry' }
Expected output { 'Henry', 'Noah', 'Oliver' }

Answers

Answer 1

Answer:

Explanation:

The following Python code asks the user for inputs for the name to remove and add in the set. It then tries to remove the given name from the list. If it fails it prints out to the user saying that the name does not exist. If it does exist then it removes the name and adds the new name. Finally it prints out the current list of names.

male_names = {'oliver', 'Declan', 'Henry'}

name_to_remove = input("Enter name to remove: ")

name_to_add = input("Enter name to add: ")

try:

   male_names.remove(name_to_remove)

   male_names.add(name_to_add)

except:

   print("Name that you are trying to remove does not exist")

print("List of Names: ")

print(male_names)

Creating And Modifying Sets. The Top 3 Most Popular Male Names Of 2017 Are Oliver, Declan, And Henry
Answer 2

In this exercise we have to use the knowledge of the python language to write the code, so we have to:

The code is in the attached photo.

So to make it easier the code can be found at:

male_names = {'oliver', 'Declan', 'Henry'}

name_to_remove = input("Enter name to remove: ")

name_to_add = input("Enter name to add: ")

try:

  male_names.remove(name_to_remove)

  male_names.add(name_to_add)

except:

  print("Name that you are trying to remove does not exist")

print("List of Names: ")

print(male_names)

See more about python at brainly.com/question/26104476

Creating And Modifying Sets. The Top 3 Most Popular Male Names Of 2017 Are Oliver, Declan, And Henry

Related Questions

63. Name the 4 main lights & and their primary purpose.

Answers

I don’t know this !!

What can a developer do to customize a macro beyond the simple tools of the Macro Design tab?
O Edit the macro in the SQL view.
O Make the macro a security risk.
O Eliminate restricted actions from the macro.
O Edit the macro in the Visual Basic language.

Answers

Answer: D is the answer I did the assignment.

Explanation:

C++
Is there any difference between Class and Structure? Prove with the help of example.

Answers

Answer:

5555

Explanation:

The class is reference type (it is a pointer and is assigned on the heap), structure and value type (and is allocated on the stack). The difference is important in terms of memory management.

is pseudocode obtained from Algorithm or is Algorithm obtained from pseudocode?

Answers

Answer:

An algorithm is defined as a well-defined sequence of steps that provides a solution for a given problem, whereas a pseudocode is one of the methods that can be used to represent an algorithm.

hope this gives you at least an idea of the answer:)

Choose a problem that lends to an implementation that uses dynamic programming. Clearly state the problem and then provide high-level pseudocode for the algorithm. Explain why this algorithm can benefit from dynamic programming. Try to choose an algorithm different from any already posted by one of your classmates.

Answers

Answer:

Explanation:

The maximum weighted independent collection of vertices in a linear chain graph is a straightforward algorithm whereby dynamic programming comes in handy.

Provided a linear chain graph G = (V, E, W), where V is a collection of vertices, E is a set of edges margins, and W is a weight feature function applied to each verex.  Our goal is to find an independent collection of vertices in a linear chain graph with the highest total weight of vertices in that set.

We'll use dynamic programming to do this, with L[k] being the full weighted independent collection of vertices spanning from vertex 1 \to vertex k.

If we add vertex k+1 at vertex k+1, we cannot include vertex k, and thus L[k+1] would either be equivalent to L[k] when vertex k+1 is not being used, or L[k+1] = L[k-1] + W[k+1] when vertex k+1 is included.

[tex]Thus, L[k+1] = max \{ L[k], \ L[k-1] + W[k+1] \}[/tex]

As a result, the dynamic programming algorithm technique can be applied in the following way.

ALGO(V, W, n) // V is a linearly ordered series of n vertices with such a weight feature W

[tex]\text{1. L[0] = 0, L[1] = W[1], L[2] = max{W[1], W[2]} //Base cases} \\ \\ \text{2. For i = 3 to n:- \\} \\ \\\text{3........ if ( L[i-1] > L[i-2] + W[ i ] )} \\ \\ \text{4............Then L[ i ] = L[i-1]} \\ \\ \text{5.........else} \\ \\ \text{6................L[i] = L[i-2] + W[i] }\\ \\ \text{7. Return L[n] //our answer.}[/tex]

As a result, using dynamic programming, we can resolve the problem in O(n) only.

This is an example of a time-saving dynamic programming application.

Which options are available when using a combo box rather than a list box? Check all that apply. A user can type in the values. A user can search for a record. The combo box can sort through records. A user can get values from another query. The combo box includes drop-down menus. A user can retrieve values from another table.

Answers

Answer:

A, B, D, F

Explanation:

ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP​

Answers

Answer:

13.c

14.d

15.b

16.a

17.c

Explanation:

please brainleist please ☺️♨️

FREE YOU KNOW WHAT DIG IN

Answers

Answer:

Thank you so much!!!!!!

Have a great day!

Explanation:

tnx for ponits .........

Which describes the third step in visual character development?

Answers

3d model of a character is the third step

What is the size of type int on 64 bit system

(1/1 Point)


4 byte


8 byte


16 byte


None of the given

Answers

The answer is none of the given

NO LINKS
write a shell script to find the sum of all integers between 100 and 200 which are divisible by 9​

Answers

Answer:

#!/usr/bin/env bash

for num in {100..200}

do

   if [ $((num % 9)) -eq 0 ]

   then

       ((sum += num))

   fi

done

echo $sum

Explanation:

The output will be 1683.

What is an interface in android? a) Interface acts as a bridge between class and the outside world.
b) Interface is a class. c) Interface is a layout file. d) None of the above

Answers

Answer:

Explanation:

Im thinking C hope this helps :))

The interface in an android serves as a layout file.

What is an User interface?

An User interface also called a UI, is an in-built system that serves as a hierarchy of layouts and widgets.

Thus, the interface in an android serves as a layout file.

Therefore, the Option C is correct

Read more about interface

brainly.com/question/5080206

Use the drop-down tool to select the word or phrase that completes each sentence.

The manipulation of data files on a computer using a file browser is
.

A
is a computer program that allows a user to manipulate files.

A
is anything that puts computer information at risk.

Errors, flaws, mistakes, failures, or problems in a software program are called
.

Software programs that can spread from one computer to another are called
.

Answers

Answer:

file management file manager security threat bugs virus

Explanation:

Let's make a song, continue from these lines

My heart is dead
My mind is in a loop

Answers

My head hurts

Underpressure

Explanation:

a trance that I cant stop

6.22 LAB: Output values below an amount - methods
Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Assume that the list will always contain less than 20 integers.

Ex: If the input is:

5 50 60 140 200 75 100
the output is:

50 60 75
The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75. For coding simplicity, follow every output value by a space, including the last one.

Such functionality is common on sites like Amazon, where a user can filter results.

Write your code to define and use two methods:
public static void getUserValues(int[] myArr, int arrSize, Scanner scnr)
public static void outputIntsLessThanOrEqualToThreshold(int[] userValues, int userValsSize, int upperThreshold)

Utilizing methods will help to make main() very clean and intuitive.


My Code & Error Message Attached
import java.util.Scanner;

public class LabProgram {

public static void GetUserValues(int[] myArr, int arrSize, Scanner scnr){
int i;
for(i=0;i myArr[i] = scnr.nextInt();
}
}

public static void outputIntsLessThanOrEqualToThreshold(int[] userValues, int userValsSize, int upperThreshold) {
int i;
for(i=0;i if(userValues[i] <= upperThreshold)
System.out.print(userValues[i]+" ");
}

}

public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int[] userValues = new int[20];
int upperThreshold;
int numVals;

numVals = scnr.nextInt();
GetUserValues(userValues, numVals, scnr);

upperThreshold = scnr.nextInt();
outputIntsLessThanOrEqualToThreshold(userValues, numVals, upperThreshold);
System.out.println();

}
}

Answers

Answer:

hope this helps.

Explanation:

n = int(input())

lst = []

for i in range(n):

lst.append(int(input()))

threshold = int(input())

for x in lst:

if x < threshold:

print(x)

Following are the Java program to find the less number from 100 in 5 number of the array:

Java Program to check array numbers:

please find the code file in the attachment.

Output:

Please find the attached file.

Program Explanation:

import package.Defining class LabProgram Inside the class two methods "GetmyArr, outputIntsLessThanOrEqualToThreshold"  is defined that takes three variable inside the parameters.In the "GetmyArr" method it takes one array and one integer variable and a scanner that inputs the array value "myArr" which limits set into the "arrSize" variable. In the "outputIntsLessThanOrEqualToThreshold" method it takes three parameters "myArr, arrSize, and upperThreshold". In this, it checks array value is less than "upperThreshold", and prints its value.Outside this main method is defined that defines array and variable and class the above method.

Find out more about the java code here:

brainly.com/question/5326314

Which of the following items are both an input and output device?

Answers

Answer:

Printer (output) Camera (input), and others

Explanation:

Ralph and his team need to work together on a project. If they need a device that will provide shared storage with access to all team members, which of these devices would work best? *

USB Flash Drive
2 TB HDD installed on one of their computers
BD-RW installed on one of their computers
Network attached storage appliance

Answers

You will need a network attached storage appliance

Now you are ready to implement a spell checker by using or quadratic. Given a document, your program should output all of the correctly spelled words, labeled as such, and all of the misspelled words. For each misspelled word you should provide a list of candidate corrections from the dictionary, that can be formed by applying one of the following rules to the misspelled word:
a) Adding one character in any possible position
b) Removing one character from the word
c) Swapping adjacent characters in the word
Your program should run from the command line as follows:
% ./spell_check
You will be provided with a small document named document1_short.txt, document_1.txt,
and a dictionary file with approximately 370k words named wordsEnglish.txt.
As an example, your spell checker should correct the following mistakes.
deciive -> decisive (Case A)
deciasion -> decision (Case B)
ocunry -> counry (Case C)
//spell_check.cc file
#include "quadratic_probing.h"
#include
#include
#include
using namespace std;
int testSpellingWrapper(int argument_count, char** argument_list) {
const string document_filename(argument_list[1]);
const string dictionary_filename(argument_list[2]);
// Call functions implementing the assignment requirements.
// HashTableDouble dictionary = MakeDictionary(dictionary_filename);
// SpellChecker(dictionary, document_filename);
return 0;
}
// Sample main for program spell_check.
// WE WILL NOT USE YOUR MAIN IN TESTING. DO NOT CODE FUNCTIONALITY INTO THE
// MAIN. WE WILL DIRECTLY CALL testSpellingWrapper. ALL FUNCTIONALITY SHOULD BE
// THERE. This main is only here for your own testing purposes.
int main(int argc, char** argv) {
if (argc != 3) {
cout << "Usage: " << argv[0] << " "
<< endl;
return 0;
}
testSpellingWrapper(argc, argv);
return 0;
}

//quadratic_probing.h file
#ifndef QUADRATIC_PROBING_H
#define QUADRATIC_PROBING_H
#include
#include
#include
namespace {
// Internal method to test if a positive number is prime.
bool IsPrime(size_t n) {
if( n == 2 || n == 3 )
return true;
if( n == 1 || n % 2 == 0 )
return false;
for( int i = 3; i * i <= n; i += 2 )
if( n % i == 0 )
return false;
return true;
}
// Internal method to return a prime number at least as large as n.
int NextPrime(size_t n) {
if (n % 2 == 0)
++n;
while (!IsPrime(n)) n += 2;
return n;
}
} // namespace
// Quadratic probing implementation.
template
class HashTable {
public:
enum EntryType {ACTIVE, EMPTY, DELETED};
explicit HashTable(size_t size = 101) : array_(NextPrime(size))
{ MakeEmpty(); }
bool Contains(const HashedObj & x) const {
return IsActive(FindPos(x));
}
void MakeEmpty() {
current_size_ = 0;
for (auto &entry : array_)
entry.info_ = EMPTY;
}
bool Insert(const HashedObj & x) {
// Insert x as active
size_t current_pos = FindPos(x);
if (IsActive(current_pos))
return false;
array_[current_pos].element_ = x;
array_[current_pos].info_ = ACTIVE;
// Rehash; see Section 5.5
if (++current_size_ > array_.size() / 2)
Rehash();
return true;
}
bool Insert(HashedObj && x) {
// Insert x as active
size_t current_pos = FindPos(x);
if (IsActive(current_pos))
return false;
array_[current_pos] = std::move(x);
array_[current_pos].info_ = ACTIVE;
// Rehash; see Section 5.5
if (++current_size_ > array_.size() / 2)
Rehash();
return true;
}
bool Remove(const HashedObj & x) {
size_t current_pos = FindPos(x);
if (!IsActive(current_pos))
return false;
array_[current_pos].info_ = DELETED;
return true;
}
private:
struct HashEntry {
HashedObj element_;
EntryType info_;
HashEntry(const HashedObj& e = HashedObj{}, EntryType i = EMPTY)
:element_{e}, info_{i} { }
HashEntry(HashedObj && e, EntryType i = EMPTY)
:element_{std::move(e)}, info_{ i } {}
};
std::vector array_;
size_t current_size_;
bool IsActive(size_t current_pos) const
{ return array_[current_pos].info_ == ACTIVE; }
size_t FindPos(const HashedObj & x) const {
size_t offset = 1;
size_t current_pos = InternalHash(x);
while (array_[current_pos].info_ != EMPTY &&
array_[current_pos].element_ != x) {
current_pos += offset; // Compute ith probe.
offset += 2;
if (current_pos >= array_.size())
current_pos -= array_.size();
}
return current_pos;
}
void Rehash() {
std::vector old_array = array_;
// Create new double-sized, empty table.
array_.resize(NextPrime(2 * old_array.size()));
for (auto & entry : array_)
entry.info_ = EMPTY;
// Copy table over.
current_size_ = 0;
for (auto & entry :old_array)
if (entry.info_ == ACTIVE)
Insert(std::move(entry.element_));
}
size_t InternalHash(const HashedObj & x) const {
static std::hash hf;
return hf(x) % array_.size( );
}
};
#endif // QUADRATIC_PROBING_H

Answers

Answer:

Sorry po idont know po ehhh sorry

Which of the following is a goal of summarizing?

Answers

Answer:

b

Explanation:

its B mygee

What career opportunities are available within the floral industry?

Answers

Answer: The floral industry has quite an array of possible occupation pathways. You can do flower production, design, publishing, marketing, home design, engineering, retailing, commercial, research, and lots more.

Peter is explaining the steps to create a fire effect in an image to his class. Help Peter pick the correct word to complete the explanation.
After your text is created, duplicate the layer so that you have two versions. Next, apply a number of blank
options to the duplicated text layer.

Answers

Answer:

The answer would be "Blending"

Explanation:

I took the test and checked over my answers

Given two integers as user inputs that represent the number of drinks to buy and the number of bottles to restock, create a VendingMachine object that performs the following operations:

Purchases input number of drinks Restocks input number of bottles.
Reports inventory Review the definition of "VendingMachine.cpp" by clicking on the orange arrow.
A VendingMachine's initial inventory is 20 drinks.

Ex: If the input is: 5 2
the output is: Inventory: 17 bottles

Answers

Answer:

In C++:

#include <iostream>

using namespace std;

class VendingMachine {

 public:

   int initial = 20;};

int main() {

 VendingMachine myMachine;

   int purchase, restock;

   cout<<"Purchase: ";  cin>>purchase;

   cout<<"Restock: ";  cin>>restock;

   myMachine.initial-=(purchase-restock);

   cout << "Inventory: "<<myMachine.initial<<" bottles";  

   return 0;}

Explanation:

This question is incomplete, as the original source file is not given; so, I write another from scratch.

This creates the VendingMachine class

class VendingMachine {

This represents the access specifier

 public:

This initializes the inventory to 20

   int initial = 20;};

The main begins here

int main() {

This creates the object of the VendingMachine class

 VendingMachine myMachine;

This declares the purchase and the restock

   int purchase, restock;

This gets input for purchase

   cout<<"Purchase: ";  cin>>purchase;

This gets input for restock

   cout<<"Restock: ";  cin>>restock;

This calculates the new inventory

   myMachine.initial-=(purchase-restock);

This prints the new inventory

   cout << "Inventory: "<<myMachine.initial<<" bottles";  

   return 0;}

Which of the following does PXE use?
a) USB
b) DVD-ROM
c) CD-ROM
d) NIC

Answers

Answer:

The answer is d) NIC.

Explanation:

PXE Stands for Preboot Execution Environment and a PXE uses an NIC also know as Network Interface Controller. For an example: If you have a DELL Inspiron 8500 and you couldn't get it to work you would need to go through all boot-up system including a Preboot Execution Environment in the booting code protocols it would say connecting to NIC after 6 seconds it would say NIC connected then it would search for a boot device after a few munities since the DELL Inspiron 8500 is obsolete you would get this message:

No Boot Device found

What are the advantages and disadvantages of the lenses used on cameras in capturing black and white film?

Answers

The lenses that are used on cameras in capturing black and white film are vital for creating timeless pictures and highlighting the shape and pattern in the image.

Black and white photography is an image where all the colors have been removed. This can be by choice of the photographic film.

The advantage of the lenses used on cameras in capturing black and white film:

It's vital for creating a timeless picture.It highlights form, shape, and pattern.It's vital in distancing the content material from reality.

The disadvantage of the lenses used on cameras in capturing black and white film is that it lacks emotions which a colored photograph will have reflected.

Read related link on:

https://brainly.com/question/22250013

Advantages that can be associated with the lens of of camera that is utilized in capturing black and white film are:

It helps to give the highlight of the pattern and shape of the content.

It can be stored for longer time ( timelessness).

disadvantages that can be associated with the lens of of camera that is utilized in capturing black and white film is that it doesn't portray emotions.

Black and white photography can be regarded as one that doesn't contain variety of color.

It is a photography that doesn't portray an emotion, emotions in this sense means color, which serves a disdvantage.

We can conclude that this type of photography give room fir a picture that can remain for long time, it's timeless and this serve as one of the advantage.

Learn more at:

https://brainly.com/question/20176933?referrer=searchResults

Which of the following is not part of the four ways you can avoid problems with email communication?
a.
Be brief.
b.
Proofread your message.
C.
Reply right away after you get an email.
d.
Seek other ways to relay your message

Answers

Answer:

d is the correct answer for this problem

Which element adjusts the space around the data in each cell of a table? adjusts the space around the data in each cell of a table.

Answers

Answer:

Increase/decrease indentation

Explanation:

Answer:

(Cellpadding) is actually the correct answer.

Explanation:

Cellpadding and cellspacing are two important features of an HTML table. Cellpadding sets the space around the data in each cell. Cellspacing sets the space around each cell in the table.

Earth, Wind & Fire were NOT known for combining many different styles of music together.Required to answer. Single choice.
(1 Point)

True

False

Answers

Answer:

false

Explanation:

Cause I don't believe you can't use earth, wind,and fire to create music.

Which symbol is used for an assignment statement in a flowchart?

Answers

Equal symbol

equal symbol

Within most programming languages the symbol used for assignment is the equal symbol.

When the function below is called with 1 dependent and $400 as grossPay, what value is returned?

double computeWithholding (int dependents, double grossPay)

{
double withheldAmount;
if (dependents > 2)
withheldAmount = 0.15;
else if (dependents == 2)
withheldAmount = 0.18;
else if (dependnets == 1)
withheldAmount = 0.2;
else // no dependents
withheldAmount = 0.28;
withheldAmount = grossPay * withheldAmount;
return (withheldAmount);
}

a. 60.0
b. 80.0
c. 720.0
d. None of these

Answers

Answer:

b. 80.0

Explanation:

Given

[tex]dependent = 1[/tex]

[tex]grossPay = \$400[/tex]

Required

Determine the returned value

The following condition is true for: dependent = 1

else if (dependnets == 1)

withheldAmount = 0.2;

The returned value is calculated as:

[tex]withheldAmount = grossPay * withheldAmount;[/tex]

This gives:

[tex]withheldAmount = 400 * 0.2[/tex]

[tex]withheldAmount = 80.0[/tex]

Hence, the returned value is 80.0

What is the molar mass of AuCI2

Answers

Answer:267.8726

Explanation:

Other Questions
Rewrite the expression by combining like terms.8y^2 + 7xy 2y^2 - 5xy + 2x Who were the facist leaders of Germany, Italy and Spain during WWII? The horse achieved its highest status during the___________dynasty (618-906 CE), a time of unparalleled political, artist, and cultural greatness.A. QinB. HanC. TangD. Shang (112 credit)Which of these can be a result of drinking alcohol? Check all that apply.A young person may become more creative,A young person may forget to use contraceptionA young person may display increased self-control.A young person may display impaired judgementA fetus may suffer from the mother's pregnancy complications. help me outno links Cystic Fibrosis is an autosomal recessive disorder. Neither parent has the disease. Their first child (Joey) Has cystic fibrosis. What are the chances that their next child will have cystic fibrosis? Use the letter A for the alleles for cystic fibrosis. SHOW ALL WORK FOR CREDIT. (To insert a table in your answer if necessary click on the three dots, click on the icon that looks like a table and you can customize the number and type of boxes you need) Liam and Michael are going to play video games this afternoon. Together, they have 38 video games. If they decide to randomly choose two video games, what is the probability that the two they choose will consist of each of their favorite video games? Assume they have different favorites. Express your answer as a fraction in lowest terms or a decimal rounded to the nearest millionth. Where can I find a good lawyer? [sdddd]\alpha 12[/dss] [tex]\left[\begin{array}{ccc}11&12&13\\21&22&23\\31&32&33\end{array}\right][/tex]32 Plss HelpWILL GIVE OUT BRAINLIEST ANSWER list some application of atmospheric pressure? Find the surface area of the pyramid. The side lengths of the base are equal. Square pyramid with base edge of 12 centimeters, and a slant height measuring 17 centimeters, on a triangular face. The surface area is square centimeters. Video journalism, in the form of documentary filmmaking, is experiencing a remarkable decline due to the lack of current technological advances in this genre.TrueFalse Jared made a scale drawing of his classroom for his tech project. He used a scale of 1 cm = 3.5 ft. If the length of his classroom on the drawing measured 30 cm, What is the actual length of his classroom? is 12 - 3z + 6z2 and 6(z - 2) equivalent The ages in years, of a group of friends are listed.29, 33, 35, 49, 50, 51, 52, 29Find the following (all answers are whole numbers):Mean: Median: Mode: Range: Which measure best represents the data? (Write mean, median, mode, or range using lowercase letters and make sure it is spelled correctly) Plz help if correct ill give Brainlyest Draw a chameleon with watercolors 8. Of what importance is a smoker to a person keeping bees? Jasmine bought a ticket to the Jets game. She got a 25% discount on her ticket but then had to pay a 10% service fee on the discounted price. Jasmines final ticket price was what percent of the original ticket price? PLEASE HELP ME ASAPPPPPPPPPPPPPP!!!!!!!!! No links !!!!