The top 3 most popular male names of 2017 are oliver, Declan, and Henry according to babynames.com. 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.
Q: PYTHON PROGRAMMING #Finish the favFoods function that takes as input a list of foods and returns a…
A: Task :- Write a python program to find the the occurences of "pizza" in given list. Python program…
Q: These are assignment questions 12. Write a program to sort the string "ougojxpvrkoawwja" in…
A: Answer in step2
Q: Lets the user enter courses and prints them out correctly at the end Catches there being six courses…
A: Good use of functions just means, use functions (yes the one we create with def) to do common tasks.…
Q: Sentence Reverse Given a long sentance, reverse each word in it and there order, so you the snetec…
A: The Complete answer is given below with the output.
Q: Let n be a positive integer consisting of up to ten digits, d10, d9 ,…..,d1. Write a Phyton program…
A: The list is a data structure in which it is a collection of items and the list is mutable. The items…
Q: Step 3. Your starting code has a function readNames returns an array of student names. The temporary…
A: The final java program is given below import java.io.*; import java.util.*; import…
Q: 3. Use the input function to ask the user for a positive, whole number. Then use a for loop to…
A: Find the required code given as below and output:
Q: //////////// //////////// //////////// how do i solve this problem in java?
A: Java is object- oriented programming language developed by James gosling in 1995. It is platform…
Q: 1. You are given N number of intervals, where each interval contains two integers denoting the start…
A: The java code along with the snapshot of code and output is given below:
Q: Q2. Write a program to calculate the value of y, where x, is series of value in data set (x[i]), n…
A: Note :- You have not mention the language of program ,So i am doing you question in C++ language.…
Q: char test [80]; char choice; int n; printf ("String to sort>> "); gets (test); n=strlen (test); puts…
A: Given:-
Q: Add lists to the program below and a function where it is used. Identify them
A: Use separate list for heights and weights Call the function by passing weights and heights list
Q: Write a program that produces this output: /* Output: Enter 5 cities: Enter a city: Enter a city:…
A: First, we will declare the array of cities. Then we will call the function getcities() to input the…
Q: hè ušer för the number of 7/Given a string, take n input from students and then put them in the…
A: #include<bits/stdc++.h> using namespace std; struct Student { int rollnumber; string…
Q: with pseudocode Write a program that uses a dictionary to record five courses and their current…
A: Required: Write a program that uses a dictionary to record five courses and their current grades.…
Q: Java
A: //import the required package import java.util.Scanner; //create the main class public class InOrder…
Q: Two arrays list1 and list2 are identical if they have the same contents. Write a function that…
A: Two arrays list1 and list2 are identical if they have the same contents. Write a function that…
Q: Write a program to input two names from the user (let's say first name and second name). The program…
A: Input two string Copy them to arrays Create final array and store both arrays
Q: 6.23 LAB: Fibonacci sequence The Fibonacci sequence begins with 0 and then 1 follows. All subsequent…
A: As given, we need to write a Python program having a function called fibonacci() that takes index n…
Q: 1. a. Correct the following code so that it generates 50 random integers in the range of 30 up to…
A: array size is 50 not 49 for loop less than array length is enough because array index start from 0…
Q: How to write an HTML code for this javascript result/output? where the result will be displayed in…
A: To write the HTML code for a javascript code, you can either create a file for HTML only separately…
Q: Ground rules for the problem: • The only things you can use are the built-in min and max, as well as…
A: Since no programming language is mentioned, I have implemented the given instructions in Java…
Q: Assignment 2 Write a program that repeatedly takes pairs of name,salary (separated by comma) from…
A: Please give positive ratings for my efforts. Thanks. PROGRAM salaries = {} while True:…
Q: Write a function that returns True if two arrays, when combined, form a consecutive sequence. A…
A: Algorithm - Take input from the user. Now use the below logic - c = a + b x,y =…
Q: . You are given N number of intervals, where each interval contains two integers denoting the start…
A: Q: Code the given problem
Q: Q3/ Write a program to reserve an array 7x7, like the shape below using loop function only. в в в в…
A: Start. Create an array. The size of the array will be 7*7. put the values in the array as shown in…
Q: (Sort students) Write a program that prompts the user to enter the number of stu- dents, the…
A: The Answer is
Q: Create a program which will ask the user to enter a list of names and provide a poker tournament…
A: #include<iostream> #include<string> #include<vector> #include <algorithm>…
Q: Take five numbers from the user and find the minimum and the average of only the even numbers…
A: n is a number of elements in the array and array[] are used to hold the elements. Now, check the…
Q: VIII. Summarize the names and ages in three-column-format For Example, Tom Doe 30 Lisa Young 27 name…
A: Program has two string variables to store names. It also has two integer variables to store ages.…
Q: Create a function that counts the integer's number of digits. Examples count (318) → 3 count…
A: Algorithm - First we will create a method count. Now take one integer input. Now return the…
Q: he Apgar Medical group keeps a patient file for each doctor in the office. Each record contains the…
A: Given question has asked to design the logic that produces a merged list of patients' names in…
Q: Two two-dimensional arrays m1 and m2 are strictly identical if their corresponding elements are…
A: logic:- read two arrays of 3 by 3 size. Pass both matrix to function equals. Iterate from i=0 to…
Q: Exercise 5: Write a Python program that reads from an input from user n student test scores in the…
A: Algorithm: - To Solve this problem we will mainly use the if-else condition inside the For…
Q: Search of Strings 1. Write a version of the selection sort algorithm presented in the unit, which is…
A: #include <iostream>#include <vector>using namespace std; void…
Q: Create a program which will ask the user to enter a list of names and provide a poker tournament…
A: As the programming language is not mentioned here, we are using JAVA The complete code is given…
Q: nacci sequence begins with 0 and then 1 follows. All subsequent values are the sum of the previous…
A: Given The Fibonacci sequence begins with 0 and then 1 follows. All subsequent values are the sum of…
Q: 6.23 LAB: Output numbers in reverse Write a program that reads a list of integers, and outputs those…
A: Required:
Q: Q3/ Write a program to reserve an array 7x7, like the shape below using loop function only. Ву с++ В…
A: #include <iostream> using namespace std; int main() { char a[7][7]; int j=6; int…
Q: in python Create a list of 20 random grades between 0 and 100. Write the code for a filtering that…
A: Answer Code in Python import random lst = random.sample(range(0, 100), 20) output =…
Q: screenchot of input and output import string pp = '''Peter Piper picked a peck of pickled…
A: Algorithm: Start Initialize a string Remove punctuation from the string Split the string and find…
Q: Write a program that replaces the name of each month with its three-letter abbreviation. Save it as…
A: A list is a mutable (element can be changed) type collection of elements enclose between '[' and…
Q: CHALLENGE 9.8.1: Convert to binary - functions. АCTIVITY Start Write a program that takes in a…
A: here 1101 is the reverse binary representation of the input number given as 11. thus , the output…
Q: Exercise 3: Write a program that reads from an input file “scores.txt” student test scores in the…
A: Objective: Need to write a program to read students' scores from a file and store the data to a…
Q: In shell scripting
A: The series mentioned above is arithmetic series as there is a pattern of adding a set of numbers in…
Q: 4. Use a for loop to print a list containing your name, enrollment number, state, date of birth,…
A: 4. The current scenario here is to write the r programming code to print a list that containing the…
Q: Create a list L containing at least 10 values ranging from j to k. Using a for loop, code a function…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Initialize list L…
Q: c# Write a program , that allows the user to enter an array of elements (integers) then sort these…
A: Problem : Sort in ascending order Programming Language : c# In the below implementation, an array of…
Q: Examine the code below: import random list1= [10, 20, 30, 40, 50] print(random.sample(list1, 2))…
A: The sample method of the random library is utilized to take random numbers or values from a list or…
Task :- Write a python program to add and remove names from given set.
Python program :-
male_names = {'Oliver', 'Declan', 'Henry'}
name_to_remove = input()
name_to_add = input()
# first remove input name from the set
male_names.remove(name_to_remove)
# Now add name to the set
male_names.add(name_to_add)
#print modified set
print(male_names)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- The top 3 most popular male names of 2017 are Oliver, Declan, and Henry according to babynames.com. 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.In Python, grades_dict = {'Wally': [87,96,70], 'Eva': [100,87,90], 'Sam': [94,77,90], 'Katie': [100,81,82], 'Bob': [83, 65, 85]} Ask user to enter the names of the rows, i.e., indices. You can use: len(grades) to get the number of rows of the DataFrame. In addition, using the sort_index() method, ask user whether they wish to sort by rows or by columns and whether to sort in ascending or descending order (do not use any if-else statements)1. Practice Conditional Expressions: python Write a function, record_result, that returns “Record Broken!” if the first parameter is less than the second parameter and “Record remains unchanged” otherwise. Do this in one line using a conditional expression. print(record_result(2.31,2.32)) 2. Practice Sets: python Write a function, sort_unique, that returns a list of cities sorted alphabetically after duplicates have been removed. Do this in one line using casting. print(sort_unique(["NYC","ATL","ATL"]))
- Two two-dimensional arrays m1 and m2 are strictly identical if their corresponding elements are equal. Write a function that returns true if m1 and m2 are strictly identical, using the following header: const int SIZE = 3; bool equals(int m1[][SIZE], int m2[][SIZE], int rowSize) Write a test program that prompts the user to enter two 3x3 arrays of integers and displays whether the two are strictly identical. Here are the sample runs. <Output> Enter list1: 51 22 25 6 1 4 24 54 6 Enter list2: 51 22 25 6 1 4 24 54 6 Two arrays are strictly identical <End Output> <Output> Enter list1: 51 25 22 6 1 4 24 54 6 Enter list2: 51 22 25 6 1 4 24 54 6 Two arrays are not strictly identical C++The results of a survey of the households in your township are available for public scrutiny. Each record contains data for one household, including a four-digit integer identification number, the annual income for the household, and the number of household members. Write a program to read the survey results into three lists and perform the followinganalysis.a) Print the record of each household included in the survey in a three-column formatwith headings.b) Calculate and print the average household income.c) List the identification number and income of each household that exceeds theaverage.d) Determine and print the identification number and income of households that haveincome below the 2018 United States’ Contiguous States poverty level.e) Determine and print the percentage of households that have income below the 2018United States’ Contiguous States poverty level.Compute the poverty level income using the formula below.povertyLevel = 16460.00 + 4320.00 * (m – 2)where m is the…Instead of using parallel arrays, use an array of structs and redo assignment 8as follows:struct candidateType {string name;int numVotes;double percent;};Write a program vote.cc that allows to read from a file vote.in the last names ofthe candidates in an election and the number of votes received by each candidate. Theprogram should then output each candidate’s name, the number of votes received, and thepercentage of the total votes received by the candidate in descending order. Your programshould also output the winner of the election. A sample output is:Candidate Votes Received % of Total VotesJohnson 6000 31.09Brown 5000 25.91Miller 4000 20.73Duffy 2500 12.95Robson 1800 9.33Total 19300The Winner of the Election is JohnsonYour program should have and use at least the following functions:(a) Write a function openFile that prompts a user to enter a file name and opens it.(b) Write a function closeFile that closes an open file.(c) Write a function getData that reads from the file the…
- In Python, grades = {'Tim': [87,96,70], 'Sue': [100,87,90], 'Jack': [94,77,90], 'Kevin': [100,81,82], 'Bart': [83, 65, 85]} Ask user to enter the names of the rows, i.e., indices. You can use: len(grades) to get the number of rows of the DataFrame. In addition, using the sort_index() method, ask user whether they wish to sort by rows or by columns and whether to sort in ascending or descending order (do not use any if-else statements) '''Given a list, an array, or other data structure that includes a number of different data types, you want to be able to filter out all of the integers and give an output of the remaining bits of data. Aim Write a function that receives a number of arguments; using a continue statement, skip integers and print out all other values. Steps for Completion Define a function named skip_integers, with a variable number of arguments. Use a for loop to iterate over the arguments. Use a check to see whether the value passed is of the integer type. If it is, use the continue statement to ignore it. Print the arguments. The output should be as shown in Snippet 4.30: 5.2value6.0Add lists to the program below and a function where it is used. Identify them. #BMI Program def printBMI(weight,height): bmi = weight/(height*height) print("BMI is: ",bmi,"and you are ",end="") if bmi <= 18.5: print("underweight") elif 18.5 < bmi < 25: print("normal") elif 25 < bmi < 30: print("overweight") elif bmi > 30: print("obese") #MAIN PROGRAM choice = input("Press I for imperial or M for metric: ") if choice == 'I': Imperialweight = float(input("Enter weight in pounds: ")) Imperialheight = float(input("Enter height in feet (decimals): ")) Imperialweight = Imperialweight * 703 Imperialheight = Imperialheight * 12 printBMI(Imperialweight ,Imperialheight) elif choice == 'M': Metricweight = float(input("Enter weight in kilograms: ")) Metricheight = float(input("Enter height in meters: ")) printBMI(Metricweight,Metricheight)
- In the following tuples students names and the corresponding grades are given in order. • Tom is in 1st grade, Ashley is in 5th grade,….. Create a list of tuples of (name,grade) of students • use a for loop Output should be • [(‘Tom’, 1), (Ashley’, 5), (‘Paul’, 3), (‘Jack’, 2) (‘Liz’, 4)This is Python - Chapter 9 with pseudocode Write a program that uses a dictionary to record five courses and their current grades. Start with an empty dictionary and then use a loop and keyboard input to specify the course names as keys and numeric grades as values. After all five courses have been entered, use another loop and the items() method to display the course names and grades in a table, nicely formatted as you see fit with an f-string. This second loop should also determine the course name and grade of the course with the lowest grade. Report this course name and grade when the loop ends and then delete (drop) that course from the dictionary. If math is one of the courses, add 3 points to the math grade. Otherwise, report that math is not in the dictionary. In one final loop that doesn't use the items() method, display the updated courses and grades again in a table. This final loop should also determine the total of all grades so the term average accurate to one decimal…c# Write a program , that allows the user to enter an array of elements (integers) then sort these elements in ascending. Hint: first define the array, then loop to enter the elements of the array, and finally use the usual sorting code.