Capital Quiz Write a program that creates a map containing the U.S. states as keys, and their capitals as values. (Use the Internet to get a list of the states and their capitals.) The program should then randomly quiz the user by displaying the name of a state and ask the user to enter that state's capital. The program should keep a count of the number of correct and incorrect responses. (As an alternative to the U.S. states, the program can use the names of countries and their capitals.)
Q: Extract the city name and state from strings like “Utica, NY” and “Los Angeles, CA”. Assume the…
A: Code: As no coding language is mentioned providing the code in JAVA: import…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: In this problem, we need to design the code in the Python programming language. Input - Array of…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: As the programming language is not mentioned here, we are using PYTHON The code is given below with…
Q: Add a while loop to the Imperial BMI procedure below. def BMIImperial(height, weight, bmiList,…
A: First Step is declare bmiList and Category list and pass height, weight, bmiList and Category in the…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: In this problem, we need to design the code in the Python programming language. Input - Array of…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: In this problem, we need to design the code in the Python programming language. Input - Array of…
Q: get_column_choice(): this function will allow us to ask the players which pocket they want to grab…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: Algorithm - Take input from user. Now use the below logic - let isTooTall = arr.length > 3;…
Q: Task 2- Phone number input -> to character list -> to word list Two functions you need to implement:…
A: 1) Program to take a phone number from user and convert it into character and word list and display…
Q: This assignment is about temperatures and requires the main function and a custom value-returning…
A: A required program is as follows, import random '''Define a function that returns a smallest list of…
Q: 6.24 LAB: Output values below an amount - functions Write a program that first gets a list of…
A: Algorithm: Start Read number of values n Read n integer values in a vector Read threshold value…
Q: 1)Write a game of rock paper scissors, one of the choices will be from the user and the other from…
A: 1. Basically there are 3 possible input Stone Paper scissors So this is the concept of first…
Q: The mean of a list of numbers is its arithmetic average. The median of a list is its middle value…
A: Start Loop to acept array elements Calculate sum of array elemenets store in mean median <-…
Q: 6. sum_highest_five This function takes a list of numbers, finds the five largest numbers in the…
A: def sum_highest_five(l): #takes list of numbers if len(l)<5:#if list has fewer than 5…
Q: A triangular number is a number that is the sum of the integers from 1 to some integer n. Thus 1 is…
A: Python code is as follows: number = 0triangulars=[]m=int(input("Enter the value of m:…
Q: 6. sum_highest_five This function takes a list of numbers, finds the five largest numbers in the…
A: def sum_highest_five(L): # function to return sum of five highest numbers in a list s = 0…
Q: Our lists allow null elements. True or False
A: Our lists allow null elements. Answer: false the list never allows null.
Q: Write a program that creates a list of planets and their distance from the sun. c++ bring a brief…
A: CODE: #include<iostream> #include<iterator> #include<map> using namespace std; {…
Q: Return Growing NumList This function will be given a single number, it should return a list of…
A: The Answer is in Below Steps
Q: check_equivalency(tokens): Takes a list as input. Returns True if the list contains three elements,…
A: We have to write a Python program to Takes a list as input. Returns True if the list contains three…
Q: Expand positive integer intervals def expand_intervals(intervals): An interval of consecutive…
A: Code: from typing import List, NoReturn, Any def collapse_intervals(items: List[int]) -> str:…
Q: 1- write the removeLast function which removes the last digit from a given number, if the number…
A: PROGRAM EXPLANATION(C++): Include the header file. Define the remove last function, this function…
Q: Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns…
A: 1. Taking variable i and x for iterating in loops . 2. Using the for loop and checking if i is less…
Q: This class has 10 students write a program that prompts for each student's grade and store them in a…
A: Given:
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: function isUnfairHurdle(hurdles) { const tooHigh = hurdles.length >= 4; let tooClose = false;…
Q: 1994 Weekly Gas Graph In the student sample programs for this book, you will find a text file named…
A: For this program you have to save your text file as 1994_Weekly_Gas_Averages.txt and save you python…
Q: Mini program - after the quiz Simulate a spinner game. 3 2 Simulate a spinner with the numbers 1-8…
A: The python program which answer all the parts is given below. The print outputs are…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: Since the programming language is not mentioned, I have provided the code using JavaScript.
Q: 3.8 LAB: Read values into a list Write a program that reads a list of integers into a list as long…
A: The above question is solved in step 2 :-
Q: Question: Find the second largest number Code below: public static int findSecondLargest(List…
A: The question is to write the complete function for the given problem.
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: Algorithm - Take input from user. Now use the below logic - let isTooTall = arr.length > 3;…
Q: Add a while loop to the BMI prcoedure below.
A: The given is a snippet of Python code where a function BMIImperial takes some parameters and print…
Q: sum_highest_five This function takes a list of numbers, finds the five largest numbers in the list,…
A: In this question, we are asked to write a sum_highest_five() funtion in python which will print the…
Q: Expand positive integer intervals def expand_intervals(intervals): An interval of consecutive…
A: split() will split a string to list based on the given delimiter len() will be used to find the…
Q: Bubble Sort HouseholdSize.py 2 HouseholdSize.py - This program uses a bubble sort to arrange…
A: Python code: householdSizes = [] numSizes = 0 total = 0.0 mean = 0.0 median = 0.0…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: In this problem, we need to design the code in the Python programming language. Input - Array of…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: Algorithm - Take input from user. Now use the below logic - let isTooTall = arr.length > 3;…
Q: .Prime Numbers In this task, you will implement a program that takes as input a number n and…
A: Given, Pseudocode of isPrime() function: Step 1: count = 2Step 2: while count < numberStep 3: if…
Q: 6.23 LAB: Output numbers in reverse Write a program that reads a list of integers, and outputs those…
A: Required:
Q: Using Clojure Write a procedure, called count-to-1, that takes a positive integer n, and returns a…
A: Language linguisticsThe artificial language has its own linguistics, that is however everything the…
Q: The two-dimensional lists m1 and m2 are identical if they have the same contents. Write a function…
A: Given: The two-dimensional lists m1 and m2 are identical if they have the same contents. Write a…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: I give the code in Python along with output and code screenshot
Q: Write a program which accepts a sequence of comma-separated numbers from console and generate a list…
A: List in Python: A list is a data type that allows you to store various types data in it. List is a…
Q: 3.3.2: Nested loops: Print seats. Given numRows and numColumns, print a list of all seats in a…
A: NOTE - I have used python programing language to solve the problem. Here I have taken input from the…
Q: POEM_LINE = str POEM = List[POEM_LINE] PHONEMES = Tuple[str] PRONUNCIATION_DICT = Dict[str,…
A: Task : The task is to check all rhymes : given in the poem lines at given indexes.
Q: 1- The function of the List Box is to present a list of items where the user can click and select…
A: Here, Fill in the blank is given.
Q: Output values in a list below a user defined amount - functions Write a program that first gets…
A: Below is the modified Python code with approach: - Approach: - Defining the two functions…
Q: Write a program that creates a dictionary containing the U.S. states as keys, and their capitals as…
A: Python code: import randomquiz={'Andorra':'la Vella','Afghanistan':'Kabul',\ 'India':…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: Since the programming language is not mentioned , I have done the code using JavaScript.
For C++ please
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images
- Manhattan skyline def manhattan_skyline(towers):This classic problem in computational geometry (essentially, geometry that can be done using only integer arithmetic; yes, that is an actual thing) is best illustrated by pictures and animations such as those on the page "The Skyline problem", so you can first check that it out to get an idea of what is going on. Given a list of rectangular towers as tuples (s, e, h) where s and e are the start and end x-coordinates (satisfying e>s) and h is the height of that tower, compute and return the total visible area of the towers, being careful not to double count two or more towers that are partially overlapping. All towers share the same flat ground baseline at the height. The classic solution illustrates the important sweep line technique that starts by creating a list of precisely those x-coordinate values where something relevant to the problem takes place. In this problem, the relevant x-coordinates are those where some tower either…Treasure Hunter description You are in front of a cave that has treasures. The cave canrepresented in a grid which has rows numbered from 1to , and of the columns numbered from 1 to . For this problem, define (?, )is the tile that is in the -th row and -column.There is a character in each tile, which indicates the type of that tile.Tiles can be floors, walls, or treasures that are sequentially representedwith the characters '.' (period), '#' (hashmark), and '*' (asterisk). You can passfloor and treasure tiles, but can't get past wall tiles.Initially, you are in a tile (??, ). You want to visit all the treasure squares, andtake the treasure. If you visit the treasure chest, then treasurewill be instantly taken, then the tile turns into a floor.In a move, if you are in a tile (?, ), then you can move tosquares immediately above (? 1, ), right (?, + 1), bottom (? + 1, ), and left (?, 1) of thecurrent plot. The tile you visit must not be off the grid, and must not be awall patch.Determine…Exercises: Q1:Write some statements that display a list of integers from 10 to 20 inclusive ,each with its square root next to it. Q2:Write a single statement to find and display the sum of the successive even integers 2, 4,..., 200. (Answer: 10 100) Q3:Ten students in a class write a test. The marks are out of 10. All the marks are entered in a MATLAB vector marks. Write a statement to find and display the average mark. Try it on the following marks: 580 10 3 85794 (Answer: 5.9)
- Archery Scorer. Write a program that draws an archery target (see Pro-gramming Exercise 2 from Chapter 4) and allows the user to click five times to represent arrows shot at the target. Using five-band scoring, abulls-eye (yellow) is worth 9 points and each successive ring is worth 2fewer points down to 1 for white. The program should output a score foreach click and keep track of a running sum for the entire series.4. Area of a Rectangle • Write a program that compares the area of two rectangles. You can do this several ways. one way is to add the length and width of each rectangle to get it's area and then compare the two areas together. • The program should ask for the length and width of two rectangles and then tell the user which rectangle has the greater area, or if the areas are the same. • The area of a rectangle is the rectangle's length times its width. Name the source code file yourName HW4.py. • Test and run the program. Capture the output console and save it as an image file named yourName HW4 output.jpg. • Submit the py and the image files through Canvas. Note: Sample output below: Fast l: Code-Tracing Output in comenta Vart 21 Days of the Weeka) Write a program that asks user to enter number of vertices in an undirected graph and then the adjacency matrix representing the undirected graph. The program, then, must display whether the given graph is connected or not. You will find two sample runs of the program below. Sample 1 Sample 2 Enter number of vertices: 3 Enter number of vertices: 3 Enter adjacency matrix: 0 1 1 1 0 0 1 0 0 Enter adjacency matrix: 0 1 0 1 0 0 0 0 0 The graph is connected. The graph is not connected.
- String Matching): Write a program to use Horspool’s Algorithm to find the pattern in the string. You can define two variables called Text and Pattern. Please display shift table for that pattern and display the shift value for each step. If not match, display a message “Unsuccessful Search”. If match, display the index. For example, If Text =“BARD LOVED BANANAS” and Pattern=”BAOBAB”. The result will be: Shift Table: A=1, B=2, O=3, other=6 Shift 6, shift 2, shift 6, pattern not found If Text=”BARD LOVED BABAOBABANAS” and Pattern=”BAOBAB”. The result will be: Shift Table: A=1, B=2, O=3, other=6 Shift 6, shift 2, shift 2, shift 3, pattern found at position 13 Language preferred is pythonC++ language Write a program that asks the user to enter daily sale for five stores and record them in an array.The program should then display a bar graph comparing each store’s sales for all days of a week.Create each bar in the bar graph by displaying a row of asterisks. Each asterisk should representRs.1000 of sales. The program also calculates the total sale each day, and total sale of the week.Here is an example of the program s output.Enter day 1 sales for store 1: 4000 [Enter]Enter day 1 sales for store 2: 6000 [Enter]Enter day 1 sales for store 3: 10000 [Enter]Enter day 1 sales for store 4: 11000 [Enter] Enter day 1 sales for store 5: 3000 [Enter]Enter day 2 sales for store 1: 9000 [Enter]Enter day 2 sales for store 2: 8000 [Enter]Enter day 2 sales for store 3: 19000 [Enter]Enter day 2 sales for store 4: 7000 [Enter]Enter day 2 sales for store 5: 9000 [Enter]…(and so on.)Weekly SaleMonday: Total Sale: 34,000/-Store 1: **** (4000)Store 2: ****** (6000)Store 3: **********…Monthly Sales: Create a program that reads the total monthly sales for an entire year. The program outputs the average sales of the year, the names of the months above this average, and the names of the months below the average. Use a list to store the names of the months in a year, and use another list to store of the total sales for each of those months.
- Arranging Pebbles Write a program that can arrange a group of pebbles into its designated position. We have 4 types of pebbles: Red, white, blue, and green colored pebbles. Supposed that we have an n-number of pebbles, the program should be able to check the color of the pebble and arrange them in such a way that it will look something like this: Example, if there are 9 pebbles; 1 green, 3 white, 2 blue, and 3 red, the program will output something like this: RRRWWWBBGArranging Pebbles Write a program that can arrange a group of pebbles into its designated position. We have 4 types of pebbles: Red, white, blue, and green colored pebbles. Supposed that we have an n-number of pebbles, the program should be able to check the color of the pebble and arrange them in such a way that it will look something like this: Example, if there are 9 pebbles; 1 green, 3 white, 2 blue, and 3 red, the program will output something like this: RRRWWWBBG NOTE: The program will let the user to enter the pebbles and then the program will automatically arrange it. Sample output 1: R=Red, W-White, B=Blue, G=Green Enter pebbles: rwgbrgwbrg Arranged pebbles: RRRWWBBGGG Sample output 2: R=Red, W-White, B=Blue, G=Green Enter pebbles: abcde Invalid input Notice that the arrangement of the pebbles is: Red, White, Blue, GreenComputer Science Question Lab There is only one list of N ingredients in the menu. Every ingredient has its beauty value that does not depend on its taste, but on the way it looks, which is expressed as a positive integer. To order a dish, the customer asks Ramsay to use all the ingredients from L to R (L is strictly less than R). Ramsay knows that the dish will be tasty and not only beautiful if the sum of its ingredients' beauty values is divisible by K. Ramsay does not want to use all the ingredients, so he always excludes one of them. Which one? - The least beautiful one! (in other words - which has the minimal beauty value). Now he wonders - how many segments (L,R) are there such that the sum of their beauty values will be divisible by K after excluding the least beautiful ingredient. Your assignment is to develop a python code that prints the answer for the problem. Sample test case are given below:Input:3 51 2 3Output:1