Write a function endpoints that takes a list of numbers (eg. [5, 10, 15, 20, 25]) and returns a new list of only the first and last elements of the given list (eg. [5, 25]). If the input list is [5], the returned should be [5,5]. The function should return an empty list if an empty list is passed in. The function should not use any variables besides the passed in argument list_.
def endpoints(it) -> list: # YOUR CODE HERE raise NotImplementedError() ] ### BEGIN TESTS assert endpoints([5, 10, 15, 20, 251) -- 15, 25] **# END TESTS U # BEGIN TESTS assert endpoints([5]) - (5, 51 *** END TESTS [] ### BEGIN TESTS assert endpoints(0) -- 0 #*# END TESTS

Answers

Answer 1

I included a picture of my code below. Best of luck with your assignment.

Write A Function Endpoints That Takes A List Of Numbers (eg. [5, 10, 15, 20, 25]) And Returns A New List

Related Questions

Write a function called count_types that returns a dictionary with keys that are Pokemon types and values that are the number of times that type appears in the dataset. The order of the keys in the returned dictionary does not matter. In terms of efficiency, your solution should NOT iterate over the whole dataset once for each type of Pokemon since that would be overly inefficient. For example, assuming we have parsed pokemon_test.csv and stored it in a variable called data:

Answers

Answer:

Explanation:

The following code is written in Python. It creates a function called count_types which takes in three parameters. The pokemon in question, the data set, and a dictionary with all the pokemon types and values (Empty to start). Then it simply uses the built-in Python count feature to count the number of times that the Pokemon appears in the data set. Finally it saves that pokemon as a key and count as a value to the dictionary.

def count_types(pokemon, data, my_dict):

   count = data.count(pokemon)

   my_dict += {pokemon: count}

Write a program which will enter information relating to a speeding violation and then compute the amount of the speeding ticket. The program will need to enter the posted speed limit, actual speed the car was going, and whether or not the car was in a school zone and the date of the violation. Additionally, you will collect information about the driver (see output for specifics). The way speeding tickets are computed differs from city to city. For this assignment, we will use these rules, which need to be applied in this order:

Answers

Answer:

In Java:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 float speedlimit, actualspeed;

 String ddate;

 int schoolzone;

 System.out.print("Speed Limit: ");

 speedlimit = input.nextFloat();

 System.out.print("Actual Speed: ");

 actualspeed = input.nextFloat();

 System.out.print("Date: ");

 ddate = input.nextLine();

 System.out.print("School Zone (1-Yes): ");

 schoolzone = input.nextInt();

 float ticket = 75;

 ticket += 6 * (actualspeed - speedlimit);

 

 if(actualspeed - speedlimit > 30){

     ticket+=160;

 }

 if(schoolzone == 1){

     ticket*=2;

 }  

 System.out.print("Date: "+ddate);

 System.out.print("Speed Limit: "+speedlimit);

 System.out.print("Actual Speed: "+actualspeed);

 System.out.print("Ticket: "+ticket);

}

}

Explanation:

See attachment for complete program requirements

This declares speedlimit and actualspeed as floats

float speedlimit, actualspeed;

This declares ddate as string

 String ddate;

This declares schoolzone as integer

 int schoolzone;

This prompts the user for speed limit

 System.out.print("Speed Limit: ");

This gets the speed limit

 speedlimit = input.nextFloat();

This prompts the user for actual speed

 System.out.print("Actual Speed: ");

This gets the actual speed

 actualspeed = input.nextFloat();

This prompts the user for date

 System.out.print("Date: ");

This gets the date

 ddate = input.nextLine();

This prompts the user for school zone (1 means Yes, other inputs means No)

 System.out.print("School Zone (1-Yes): ");

This gets the input for schoolzone

schoolzone = input.nextInt();

This initializes ticket to $75

 float ticket = 75;

This calculates the additional cost based on difference between speed limits and the actual speed

 ticket += 6 * (actualspeed - speedlimit);

If the difference between the speeds is greater than 30, this adds 160 to the ticket  

 if(actualspeed - speedlimit > 30){

     ticket+=160;

 }

If it is in a school zone, this doubles the ticket

 if(schoolzone == 1){

     ticket*=2;

 }  

The following print the ticket information

 System.out.print("Date: "+ddate);

 System.out.print("Speed Limit: "+speedlimit);

 System.out.print("Actual Speed: "+actualspeed);

 System.out.print("Ticket: "+ticket);

— If NOT temp == 32.0 Then. Set temp = 32.0. End If.
What is the error

Answers

Answer:

im sorry so sorry i needed the pts

Explanation:

Play now? Play later?
You can become a millionaire! That's what the junk mail said. But then there was the fine print:

If you send in your entry before midnight tonight, then here are your chances:
0.1% that you win $1,000,000
75% that you win nothing
Otherwise, you must PAY $1,000

But wait, there's more! If you don't win the million AND you don't have to pay on your first attempt,
then you can choose to play one more time. If you choose to play again, then here are your chances:
2% that you win $100,000
20% that you win $500
Otherwise, you must PAY $2,000

What is your expected outcome for attempting this venture? Solve this problem using
a decision tree and clearly show all calculations and the expected monetary value at each node.
Use maximization of expected value as your decision criterion.

Answer these questions:
1) Should you play at all? (5%) If you play, what is your expected (net) monetary value? (15%)
2) If you play and don't win at all on the first try (but don't lose money), should you try again? (5%) Why? (10%)
3) Clearly show the decision tree (40%) and expected net monetary value at each node (25%)

Answers

Answer:

wow what a scam

Explanation:

The return value is a one-dimensional array that contains two elements. These two elements indicate the rows and column indices of the largest element in the two-dimensional array. Write a test program that prompts the user to enter a two-dimensional array and displays the location of the largest element in the array.

Answers

Answer:

In Java:

import java.util.Scanner;  

import java.util.Arrays;  

public class Main  {  

public static void main(String args[])  {  

Scanner input = new Scanner(System.in);

int row, col;  

System.out.print("Rows: ");    row = input.nextInt();

System.out.print("Cols: ");     col = input.nextInt();  

int[][] Array2D = new int[row][col];

System.out.print("Enter array elements: ");

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

    for(int j =0;j<col;j++){

        Array2D[i][j] = input.nextInt();  

    }     }

 

int[] maxarray = findmax(Array2D,row,col);

System.out.println("Row: "+(maxarray[0]+1));

System.out.println("Column: "+(maxarray[1]+1));

}  

public static int[] findmax(int[][] Array2D,int row, int col)   {  

int max = Array2D[0][0];

int []maxitem = new int [2];

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

    for(int j =0;j<col;j++){

        if(Array2D[i][j] > max){  

            maxitem[0] = i;

            maxitem[1] = j; } }    }

 

return maxitem;  

}  

}

Explanation:

The next two lines import the scanner and array libraries

import java.util.Scanner;  

import java.util.Arrays;  

The class of the program

public class Main  {  

The main method begins here

public static void main(String args[])  {  

The scanner function is called in the program

Scanner input = new Scanner(System.in);

This declares the array row and column

int row, col;

This next instructions prompt the user for rows and get the row input  

System.out.print("Rows: ");    row = input.nextInt();

This next instructions prompt the user for columns and get the column input  

System.out.print("Cols: ");     col = input.nextInt();  

This declares the 2D array

int[][] Array2D = new int[row][col];

This prompts the user for array elements

System.out.print("Enter array elements: ");

The following iteration populates the 2D array

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

    for(int j =0;j<col;j++){

        Array2D[i][j] = input.nextInt();  

    }     }

This calls the findmax function. The returned array of the function is saved in maxarray  

int[] maxarray = findmax(Array2D,row,col);

This prints the row position

System.out.println("Row: "+(maxarray[0]+1));

This prints the column position

System.out.println("Column: "+(maxarray[1]+1));

The main method ends here

}  

The findmax function begins here

public static int[] findmax(int[][] Array2D,int row, int col)   {  

This initializes the maximum to the first element of the array

int max = Array2D[0][0];

This declares maxitem. The array gets the position of the maximum element

int []maxitem = new int [2];

The following iteration gets the position of the maximum element

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

    for(int j =0;j<col;j++){

        if(Array2D[i][j] > max){  

            maxitem[0] = i; -- The row position is saved in index 0

            maxitem[1] = j;  -- The column position is saved in index 1} }    }

This returns the 1 d array

return maxitem;  

}  

The ABC box company makes square puzzle cubes that measure 4 inches along each edge. They shipped the cubes in a box 8 in x 12 in x 16 in. How many cubes can they ship in the box?

Answers

Answer: They can ship 32 puzzle cubes in the box.

Explanation: So the volume of each puzzle cubes = side³

=(4)³ cubic inches.

Then the volume of the box is= (8×12×16) cubic inches.

(8×12×16)/4^3= 32

g Write a program that reads a list of words, and a character. The output of the program is every word in the list of words that contains the character at least once. For coding simplicity, follow each output word by a comma, even the last one. Assume at least one word in the list will contain the given character. The number of input words is always less than and equal to 10. If the user enters more than 10 words before the character, the program will output Too many words and exit.

Answers

Answer:

Here you go, alter this as you see fit :)

Explanation:

array = []

cnt = 0

while cnt < 11:

   x = input("Enter a word: ")

   array.append(x)

   cnt += 1

   y = input("Add another word?(Y/n):  ")

   if y.lower() == "n":

       break

letter = input("\nChoose a letter: ")

if len(letter) != 1:

   print("Error: too many characters")

   quit()

for n in range(len(array)):

   if letter.lower() in array[n].lower():

       print(array[n], end= ",")

You are implementing a wireless network in a dentist's office. The dentist's practice is small, so you choose to use an inexpensive consumer-grade access point. While reading the documentation, you notice that the access point supports Wi-Fi Protected Setup (WPS) using a PIN. You are concerned about the security implications of this functionality. What should you do to reduce risk

Answers

Answer:

You should disable WPS in the access point's configuration.

Explanation:

Encryption is a form of cryptography and typically involves the process of converting or encoding informations in plaintext into a code, known as a ciphertext. Once, an information or data has been encrypted it can only be accessed and deciphered by an authorized user.

Some examples of encryption algorithms are 3DES, AES, RC4, RC5, and RSA.

In wireless access points, the encryption technologies used for preventing unauthorized access includes WEP, WPA, and WPA2.

In this scenario, you notice that an access point supports Wi-Fi Protected Setup (WPS) using a PIN and you are concerned about the security implications of this functionality. Therefore, to reduce this risk you should disable Wi-Fi Protected Setup (WPS) in the access point's configuration.

This ultimately implies that, the wireless access point will operate in an open state and as such would not require any form of password or PIN for use.

the keyboard,mouse, display,and system units are:​

Answers

Answer:

input devices?

Explanation:

Keyboard: It is used to give input through typing of the keys in keyboard. Mouse: It is used to give input through clicking mouse or selecting the options. System unit: It collectively defines the motherboard and CPU of the computer.

The keyboard, mouse, display, and system units are the four main components of a computer system.

Given that,

The devices are Keyboard, Mouse, Display, and System units.

A computer comprises hardware and software.

The hardware is the devices that are used for the input and output of the data.

The software is the devices that are integrated into the devices of the computer. This processes the data and provides the result.

The output devices show the result of our actions on the computer. Example: Screen.

The storage devices are used to store the data which are given as input. Example: Hard disk.

Thus, these all come under the hardware devices of the computer.

Read more on computer hardware here:

brainly.com/question/959479

#SPJ6

A marketing plan includes a number of factors, including the marketing mix.
What is the marketing mix?
A. The variables of product, price, place, and promotion
B. Using names and symbols to ideny the company's products
C. How the company intends for customers to view its product
relative to the competition
D. A plan for spending money
SUBMIT

Answers

A marketing plan includes a number of factors, including the marketing mix.
What is the marketing mix?
A. The variables of product, price, place, and promotion

Which elements of text can be changed using automatic formatting? Check all that apply.
A) smart quotes
B) accidental usage of the Caps Lock key
C) fractions
D) the zoom percentage
E) the addition of special characters ​

Answers

A) smart quote and B) the zoom percentage and E) the addition of special characters

Answer:a, d, e

Explanation:

what does coding mean​

Answers

the process or activity of writing computer programs.

Answer: Computer coding is the use of computer programming languages to give computers and machines a set of instructions on what actions to perform. It's how humans communicate with machines. It's what allows us to create computer software like programs, operating systems, and mobile apps.

Explanation: I hope that helps

A(an)_______is built-in preset calculation.
formula
function
equation
AutoSum​

Answers

Answer:

Hello! The answer to your question is function I had the same question and got it right!

Explanation:

Hope this helped:)

Veronica is looking for a reliable website with information about how old you have to be to use social media. What should she look for?

Answers

Answer:

The URL of the website

Explanation:

Look for .gov and .edu as they are often reliable sources

what is musical technology specifically, the origins of its genesis & its importance to the baroque era

Answers

Answer:

There were three important features to Baroque music: a focus on upper and lower tones; a focus on layered melodies; an increase in orchestra size. Johann Sebastian Bach was better known in his day as an organist. George Frideric Handel wrote Messiah as a counterargument against the Catholic Church

what would be the result of running these two lines of code? symptoms = ["cough" "fever", "sore throat", "aches"] print (symtoms[3])

Answers

"aches"

an array starts at 0 so spot the 3 is spot 4

[1,2,3,4]

arr[3] = 4 in this case

What is the maximum ream size on an agile project?

Answers

Most Agile and Scrum training courses refer to a 7 +/- 2 rule, that is, agile or Scrum teams should be 5 to 9 members. Scrum enthusiasts may recall that the Scrum guide says Scrum teams should not be less than 3 or more than 9

Explanation:

What is the value of the variable answer after the following code is executed?
String strl = "apple", str2 = "banana";
boolean answer = stri.equals(str2) && (stri.length() < str2.length());
true
false

Answers

Answer:

false

Explanation:

Changing the color of the text in your document is an example of

Answers

Answer:

???????????uhhh text change..?

Explanation:

Answer:

being creative

Explanation:

cause y not?

1.) Define Technology
2.) List 2 examples of Technology that you use everyday
3.) The building you live in is an example of this kind of technology
4.) This is technology of making things
5.) This kind of technology helps us talk to each other.
6.) This technology helps us move from one place to another

Answers

need more than 5 points for this wth

what 80s Disney movie was called the movie that nearly killed Disney? P.S. look it up

Answers

Answer:

The black cauldron

Explanation:

it was the most expensive animated film of its time ever made

Answer: The Black Couldren.

Explanation:

Jerome falls sick after eating a burger at a restaurant. After a visit to the doctor, he finds out he has a foodborne illness. One of the symptoms of foodborne illness Jerome has is .
Jerome likely got the illness after eating food.

Answers

Answer: food poisning

Explanation:

either the food wasnt

cooked properly or the food was out of date and went bad

Define the _make method, which takes one iterable argument (and no self argument: the purpose of _make is to make a new object; see how it is called below); it returns a new object whose fields (in the order they were specified) are bound to the values in the interable (in that same order). For example, if we called Point._make((0,1)) the result returned is a new Point object whose x attribute is bound to 0 and whose y attribute is bound to 1.

Answers

This picture will show you the answer and guide the way to victory

We can actually see that the _make method is known to be a function that creates named tuple type.

What is _make method?

_make method is seen in Python programming which is used to create a named tuple type instantly. It can be used for conversion of objects e.gtuple, list, etc. to named tuple.

Thus, we see the definition of _make method.

Learn more about Python on https://brainly.com/question/26497128

#SPJ2

What is a good slogan for digital citizenship?

Answers

Answer:

No matter where you are in the world you have a place to go to

Explanation:

In this world of globalization it makes sense you would be anywhere in the world and still have a place to go to.

Answer:

"If you are on social media, and you are not learning, not laughing, not being inspired or not networking, then you are using it wrong."

Explanation: (this is the freedom of speech not my words.) but there true even though and that we all (i dont know if its everyone but y'know) have to stay inside during this pandemic try to make the most of it!  

What’s the difference packet switching and message switching??

Answers

Im not sure but the person above is right x :)))


Explanation dudjdb

Create a program that writes a series of random numbers to a file, then reads the file to calculate the average of those numbers, as well as the highest and lowest numbers. Prompt the user for how many random numbers they want to add to file. If the number is less than 100, add at least 100 numbers. Each random number should be between 10 and 500, inclusive (at least 10, no more than 500). Create the file as YourName_randomnumbers.txt (where YourName is your actual name or initials...) Once the program creates the file, open and read in all numbers. Loop through the numbers and determine the highest number, the lowest number, count how many entries are in the file, and calculate the average of all numbers. Remember to use functions and comment as needed. Submit your .py file and your randomnumbers.txt file.

Answers

Answer:

In Python:

import random

def average(content):

sum = 0

for i in range(0, len(content)):  

 content[i] = int(content[i])

 sum = sum + content[i]

print("Average: "+str(round(sum/len(content),2)))

def maxList(content):

print("Highest: "+str(max(content)))

def minList(content):

print("Lowest: "+str(min(content)))

f = open("YourName_randomnumbers.txt", "w")

num = int(input("Random Numbers: "))

if num < 100:

num = 100

for i in range(1,num+1):

f.write(str(random.randint(10,500)))

f.write(" ")

f.close()

with open('YourName_randomnumbers.txt') as ff:

content = ff.read().split()

print("Entries: "+str(len(content)))

average(content)

maxList(content)

minList(content)

Explanation:

First, we import the random module

import random

The program uses functions. The first is the average function

def average(content):

This initializes sum to 0

sum = 0

This iterates through the list and adds up the list elements

for i in range(0, len(content)):

 content[i] = int(content[i])

 sum = sum + content[i]

This prints the average, rounded to 2 decimal places

print("Average: "+str(round(sum/len(content),2)))

The maxList function begins here

def maxList(content):

This gets and prints the highest of the list

print("Highest: "+str(max(content)))

The minList function begins here

def minList(content):

This gets and prints the lowest of the list

print("Lowest: "+str(min(content)))

The main begins here

This createa a file and prepares it for write operations

f = open("YourName_randomnumbers.txt", "w")

This prompts user for number of random numbers

num = int(input("Random Numbers: "))

If user input is less than 100

if num < 100:

It is set to 100

num = 100

The following iteration generates random numbers between 10 and 500 and inserts the random number to file

for i in range(1,num+1):

f.write(str(random.randint(10,500)))

f.write(" ")

Close file

f.close()

The following iteration reads the file content into a list

with open('YourName_randomnumbers.txt') as ff:

content = ff.read().split()

This prints the number of entries

print("Entries: "+str(len(content)))

The next three instructions calls the average, maxList and minList functions respectively

average(content)

maxList(content)

minList(content)

What is the output of the following code snippet if the variable named cost contains 100? if cost < 70 or cost > 150 : discount = 0.8 * cost else : discount = cost print("Your cost is ", discount)

Answers

Answer:

The output is: Your cost is  100

Explanation:

Given

The above code snippet

and

[tex]cost = 100[/tex]

Required

Determine the output of the code

if cost < 70 or cost > 150

The above condition checks if cost is less than 70 or cost is greater than 150

This condition is false because 100 is neither less than 70 nor is it greater than 150

So, the else statement will be executed.

discount = cost

Which means

discount = 100

So, the print instruction will print: Your cost is  100

What are the WORST computer malware in your opinion it can be worms backdoors and trojans I just want a input, nothing right or wrong

Answers

Answer:

I think probably mydoom

Explanation:

as it estimated 38 billion dollars in damage, also this malware is technically a worm

Does modern technology make our lives better,worse ,or doesn’t really make a change in your life ?Whats your opinion ?

Answers

It makes life better. Easy to communicate, everything you need is at your disposal, from whether forecasts to a calculator on your phone

What should Stephan do to improve his study environment? Check all that apply. remove distracting technology have easy access to his study resources ask his parents to leave the room leave some food and drink for snacks while studying allow his dad to stay only if he is helping with studying remove all food and drink from the room​

Answers

Answer:

I. Remove distracting technology.

II. Have easy access to his study resources.

III. Allow his dad to stay only if he is helping with studying.

Explanation:

A study environment can be defined as a place set aside for reading and studying of educational materials.

In order to facilitate or enhance the ability of an individual (student) to learn and assimilate information quickly, it is very important to ensure that the study environment is devoid of any form of distraction and contains the necessary study materials (resources).

Hence, to improve his study environment, Stephan should do the following;

I. Remove distracting technology such as television, radio, games, etc.

II. Have easy access to his study resources. Stephan shouldn't keep his study materials far away from his study area.

III. Allow his dad to stay only if he is helping with studying.

Answer:the person above it right

Explanation:

Other Questions
14. Shawn usually sells umbrellas for $20. On rainy days, he sells them for30% more. What is the cost on a rainy day of buying a new umbrella? *$14$26O $6O $30 For each question, decide whether or not it is a function. PLEASE HELP ASAP ALEKES ALGEBRA 2 MATH ILL GIVE BRAINLIEST Spanish it has a timer!!!!Match the Reflexive Pronouns to the correct conjugation for the verbBAARSE Fill in the chart to identify how scientists represent matter and chemical changes in matter. When the chemical name of a compound is being written, the subscripts will determine the symbols. elements. prefixes. suffixes.When the chemical name of a compound is being written, the subscripts will determine the symbols. elements. prefixes. suffixes. How does a mechanical wave affect the matter in which it travels through?AIt changes its position foreverBIt moves perpendicular to the direction of the wave.CIt has not affect on itDIt may displace it temporarily, however when the wave passes the matter returns backto its original position. simplify the following expression by combining like terms. select the most simplified expression; 2 W + 5 W - 6 + 4w Functions math please help If 2 pounds of grapes cost 6 dollars. How many ponds does 1 dollar get? what is 4 devided by 3/4 Please help! I will give brainliest! 5th grade math. Correct answer will be marked brainliest. hey yall what is this 345 x 345 + 687 Which theme is found throughout the interview with Florence Griffith-Joyner ?A. Belief in oneself creates success.B. Life is a long, difficult journey.C. Appearances can be deceiving.D. Growing up means changing. An expert is someone who Which of the points shown below are on the line given by the equation y = 4x?Check all that appply. Why are Jacks "friends" not really talking to him anymore? Please help me confirm my answer, I got C If a strand of DNA has 20% C, calculate the percentages ofG:T:A On a hot day, a soccer team drank anentire 50 gallon cooler of water, and thendrank half as much again.How much water did they drink?Ill give u brainliest if u show how you got the answer :D