Do it in python please
Write a program using functions and mainline logic which prompts the user to enter a number, then generates that number of random integers and stores them in a list. It should then display the following data to back to the user:
Helpful hint: don't forget about input validation loops and try/catch exceptional handling. Both are very useful when used in conjunction with functions.
In: Computer Science
Write a program(Python) using functions and mainline logic which prompts the user to enter a number. The number must be at least 5 and at most 20. (In other words, between 5 and 20, inclusive.) The program then generates that number of random integers and stores them in a list. The random integers should range from 0 to 100. It should then display the following data to back to the user with appropriate labels:
The list of integers
The lowest number in the list
The highest number in the list
The total sum of all the numbers in the list
The average number in the list
Use try/except to make sure the user enters an integer.
[Make it simple so that i can understand]
In: Computer Science
Write a program called listful.py, in which the user inputs names, which get added to a list. Your program should:
· Include a comment in the first line with your name.
· Include comments describing each major section of code.
· Create a list.
· Ask the user to input a first name or hit enter to end the list.
· If the user adds a first name (i.e., anything other than a blank value):
o Add the name to the list.
o Tell the user that they’ve added [name] to the list (where [name] is the name that just got added).
o Ask the user (again) to input a first name — and keep asking until the user hits enter without adding another name (i.e., enters a blank value).
· Once the user enters a blank value:
o Tell the user how many names they added to the list.
o Using a for-loop, output all the names that are in the list, using a separate line for each name.
o Do not include the blank value in the list!
In: Computer Science
a) Write a program that reads a list of integers, and outputs all even integers in the list. For example, if the input list is [1, 2, 13, 14, 25], the output list should be [2, 14].
b) Based on your code for part (a), write a program that reads a list of integers, and reports True if all numbers in the list are even, and False otherwise. Example: For input [1, 2, 13, 14, 25], the output should be False.
Your program must define and call the following two functions.
evens() returns all even integers in the list are even.
all_even() returns True if all integers in the list are even and false otherwise.
Your code could look like this
#Your name here
def evens(thelist):
#your code goes here
def all_even(thelist):
#your code goes here
evens([1, 2, 13, 14, 25]) #should return [2,14]
all_even([1, 2, 13, 14, 25]) #should return False
In: Computer Science
It is about C++linked list code. my assignment is making 1 function, in below circumstance,(some functions are suggested for easier procedure of making function.)
void pop_Stack (struct linked_list* list, int number) //*This is the function to make and below is the explanation that should be written in given code.
This function removes some nodes in stack manner; the tail of the list will be removed, repeatedly. The parameter (variable 'number') means the number of nodes that will be removed. When parameter is bigger than 1, popping a node with n times, you do not remove node at one go. If there is only one node in the list, please make sure it frees (de-allocates) both the node and the list. If the list is not a stack type(list->type_of_list!=1), print the error message “Function pop_Stack: The list type is not a stack” and exit the function. If the 'number' parameter is less than 1 or more than the number of nodes in the stack, respectively print the error message “Function popStack: The number of nodes which will be removed is more than 1” and “Function popStack: The number of nodes which will be removed is more than that in the stack”, then exit the function. The removed nodes should be freed.
Given code is written below,(There is a function to fill in last moment in this code)
linked_list.h: This is the header file of linkLQS.c that declares all the functions and values that are going to be used in linkLQS.c. You do not have to touch this function.
-----------------------------------------------------------------------
(Below code is about linked_list.h)
#include
#include
#include
struct linked_node{
int value;
struct linked_node* next;
struct linked_node* prev;
};
struct linked_list{
int type_of_list; // normal = 0, stack = 1
struct linked_node* head;
struct linked_node* tail;
int number_of_nodes;
};
-----------------------------------------------------------------------------------------------------------------------------
#include "linked_list.h"
#include "string.h"
int list_exist;
struct linked_list* create_list (int number_of_nodes, int
list_type)
{
int a[number_of_nodes];
int i, j;
int bFound;
if (number_of_nodes < 1)
{
printf("Function create_list: the
number of nodes is not specified correctly\n");
return NULL;
}
if(list_exist == 1)
{
printf("Function create_list: a
list already exists\nRestart a Program\n");
exit(0);
}
if(list_type != 0 && list_type != 1)
{
printf("Function create_list: the
list type is wrong\n");
exit(0);
}
struct linked_list * new_list = (struct
linked_list*)malloc(sizeof(struct linked_list));
new_list->head = NULL;
new_list->tail = NULL;
new_list->number_of_nodes = 0;
new_list->type_of_list = list_type;
//now put nodes into the list with random
numbers.
srand((unsigned int)time(NULL));
if(list_type == 0)
{
for ( i = 0; i <
number_of_nodes; ++i )
{
while ( 1
)
{
a[i] = rand() % number_of_nodes + 1;
bFound = 0;
for ( j = 0; j < i; ++j )
{
if ( a[j] == a[i] )
{
bFound =
1;
break;
}
}
if ( !bFound )
break;
}
struct
linked_node* new_node = create_node(a[i]);
insert_node(new_list, new_node);
}
}
else if(list_type == 1)
{
for ( i = 0; i <
number_of_nodes; ++i )
{
while ( 1
)
{
a[i] = rand() % number_of_nodes + 1;
bFound = 0;
for ( j = 0; j < i; ++j )
{
if ( a[j] == a[i] )
{
bFound =
1;
break;
}
}
if ( !bFound )
break;
}
struct
linked_node* new_node = create_node(a[i]);
push_Stack(new_list, new_node);
}
}
list_exist = 1;
printf("List is created!\n");
return new_list;
}
struct linked_node* create_node (int node_value)//This
functon is the example for reference of the assignment
function
{
struct linked_node* node = (struct
linked_node*)malloc(sizeof(struct linked_node));
node->value = node_value;
node->next = NULL;
node->prev = NULL;
return node;
}
void insert_node(struct linked_list* list, struct
linked_node* node)//This functon is the example for reference of
the assignment function
{
node->next = NULL;
node->prev = NULL;
if(list->head == NULL)
//if head is NULL, tail is also NULL.
{
list->head = node;
list->tail = node;
list_exist = 1;
}
else if(list->head == list->tail)
{
node->next =
list->head;
list->head->prev =
node;
list->head = node;
}
else if(list->head != list->tail)
{
node->next =
list->head;
list->head->prev =
node;
list->head = node;
}
(list->number_of_nodes)++;
}
void pop_Stack(struct linked_list* list, int
number)//The function to be written!!
{
~~~~~~~~~~~~~ //your code starts from here
}
In: Computer Science
The market price of calzones in a college town decreased recently, and the students in an economics class are debating the cause of the price decrease. Some students suggest that the price decreased because several new pizza parlors have recently opened in the area. Other students attribute the decrease in the price of calzones to a recent decrease in the price of cheeseburgers at local burger joints. Everyone agrees that the decrease in the price of cheeseburgers was caused by a recent decrease in the price of hamburger buns, which are not generally used in making calzones. Assume that pizza parlors and burger joints are entirely separate entities-that is, there aren't places that serve both calzones and cheeseburgers.
The first group of students thinks the decrease in the price of calzones is due to the fact that several new pizza parlors have recently opened in the area.
On the following graph, adjust the supply and demand curves to illustrate the first group's explanation for the decrease in the price of calzones.

The second group of students attributes the decrease in the price of calzones to the decrease in the price of cheeseburgers at local burger joints.
On the following graph, adjust the supply and demand curves to illustrate the second group's explanation for the decrease in the price of calzones.

Suppose that both of the events you have just analyzed are partly responsible for the decrease in the price of calzones. Based on your analysis of the explanations offered by the two groups of students, how would you figure out which of the possible causes was the dominant cause of the decrease in the price of calzones?
If the price decrease was small, then the supply shift in the market for calzones must have been larger than the demand shift.
If the equilibrium quantity of calzones increases, then the demand shift in the market for calzones must have been larger than the supply shift.
Whichever change occurred first must have been the primary cause of the change in the price of calzones.
If the equilibrium quantity of calzones increases, then the supply shift in the market for calzones must have been larger than the demand shift.
In: Economics
The market price of cheeseburgers in a college town increased recently, and the students in an economics class are debating the cause of the price increase. Some students suggest that the price increased because the price of beef, an important ingredient for making cheeseburgers, has increased Other students attribute the increase in the price of cheeseburgers to a recent increase in the price of calzones at local pizza parlors.
Everyone agrees that the increase in the price of calzones was caused by a recent increase in the price of pizza dough, which is not generally used in making cheeseburgers. Assume that burger joints and pizza parlors are entirely separate entities-that is, there aren't places that serve both cheeseburgers and calzones.
The first group of students thinks the increase in the price of cheeseburgers is due to the fact that the price of beef, an important ingredient for making cheeseburgers, has increased.
On the following graph, adjust the supply and demand curves to illustrate the first group's explanation for the increase in the price of cheeseburgers.

The second group of students attributes the increase in the price of cheeseburgers to the increase in the price of calzones at local pizza parlors.
On the following graph, adjust the supply and demand curves to illustrate the second group's explanation for the increase in the price of cheeseburgers.

Suppose that both of the events you have just analyzed are partly responsible for the increase in the price of cheeseburgers. Based on your analysis of the explanations offered by the two groups of students, how would you figure out which of the possible causes was the dominant cause of the increase in the price of cheeseburgers?
If the equilibrium quantity of cheeseburgers increases, then the supply shift in the market for cheeseburgers must have been larger than the demand shift.
If the equilibrium quantity of cheeseburgers increases, then the demand shift in the market for cheeseburgers must have been larger than the supply shift.
Whichever change occurred first must have been the primary cause of the change in the price of cheeseburgers.
If the price increase was small, then the supply shift in the market for cheeseburgers must have been larger than the demand shift.
In: Economics
8. A sample of n = 4 individuals is selected from a normal population with m = 70 and s = 10. A treatment is administered to the individuals in the sample, and after the treatment, the sample mean is found to be M = 75.
A. On the basis of the sample data, can you conclude that the treatment has a significant effect? Use a two-tailed test with a = .05.
B. Suppose that the sample consisted of n = 25 individuals and produced a mean of M = 75. Repeat the hypothesis test at the .05 level of significance.
C. Compare the results from part (a) and part (b). How does the sample size influence the outcome of a hypothesis test?
Your answers for (A), (B), and (C) respectively are
a. N.S. (meaning "Not Significant"); significant; larger n means MORE likely to be significant
b. significant; N.S.; larger n means MORE likely to be significant
c. N.S.; significant; larger n means LESS likely to be significant
d. significant; N.S.; larger n means LESS likely to be significant
9. A researcher would like to determine whether there is any relationship between students’ grades and where they choose to sit in the classroom. Specifically, the researcher suspects that the better students choose to sit in the front of the room. To test this hypothesis, the researcher asks her colleagues to help identify a sample of n = 100 students who all sit in the front row in at least one class. At the end of the semester, the grades are obtained for these students and the average grade point average is M = 3.25. For the same semester, the average grade point average for the entire college is m = 2.95 with s = 1.10. Use a two-tailed test with a = .01 to determine whether students who sit in the front of the classroom have significantly different grade point averages than other students.
NOTICE that you are asked to use a = .01!
a. sig., p<.01
b. N.S. ("not significant"), p>.01
c. sig., p>.01
d. N.S., p<.01
In: Statistics and Probability
David Anderson has been working as a lecturer at Michigan State University for the last three years. He teaches two large sections of introductory accounting every semester. While he uses the same lecture notes in both sections, his students in the first section outperform those in the second section. He believes that students in the first section not only tend to get higher scores, they also tend to have lower variability in scores. David decides to carry out a formal test to validate his hunch regarding the difference in average scores. In a random sample of 22 students in the first section, he computes a mean and a standard deviation of 84.4 and 12.8, respectively. In the second section, a random sample of 25 students results in a mean of 81.9 and a standard deviation of 1.22. Use Table 2. Sample 1 consists of students in the first section and Sample 2 represents students in the second section. a. Construct the null and the alternative hypotheses to test David’s hunch. H0: μ1 − μ2 = 0; HA: μ1 − μ2 ≠ 0 H0: μ1 − μ2 ≥ 0; HA: μ1 − μ2 < 0 H0: μ1 − μ2 ≤ 0; HA: μ1 − μ2 > 0 b-1. Calculate the value of the test statistic. (Round all intermediate calculations to at least 4 decimal places and final answer to 2 decimal places.) Test statistic b-2. What assumption regarding the population variances is used to conduct the test? Known population standard deviations. Unknown population standard deviations that are equal Unknown population standard deviations that are not equal c. Implement the test at α = 0.05 using the critical value approach. Reject H0; there is evidence that scores are higher in the first section. Reject H0; there is no evidence that scores are higher in the first section. Do not reject H0; there is evidence that scores are higher in the first section. Do not reject H0; there is no evidence that scores are higher in the first section.
In: Statistics and Probability
The local news provided poll results from 2000 adults
who interview job applicants. The results showed that 35% of the
adults said their biggest issue with interviewers is them not
knowing company history. The margin of error was given as +/- 4
percentage points. Answer the following questions:
a. What important piece of information was omitted from the
statement above?
b. What is meant by the statement that "the margin of error is +/-
4 percentage points"?
c. What are the values of?
d. If the confidence level is 95%, what is the value of?
In a poll of 555 randomly selected students, 40% stated
that they enjoyed statistics. Answer the following
questions:
a. Identify the number of students who say that they enjoy
statistics? Round to the nearest whole student if necessary.
b. Construct a 95% confidence interval estimate of the percentage
of all students who say that they enjoy statsitics.
c. Can we safely conclude that majority of students enjoy
statistics? Explain.
The following information provided below shows the
output from the results of performing a confidence interval for a
population mean. Answer the following questions:
Confidence Interval:
| (233.4, 256.65) |
| 245.025 |
| 36.35754604 |
| 40 |
a. Identify the best point estimate of
b. Find the degrees of freedom.
c. Find the critical value that corresponds to n = 40.
The cholesterol levels of 40 women were sampled and a
95% confidence interval estimate was obtained below. The units of
measurement for the interval below are
917.562 < < 2254.129
a. Identify the confidence interval. Include the appropriate units
of measure.
b. Write a statement that correctly interprets the confidence
intervale estimate of σ.
You want to estimate the mean amount of time college
students spend on the Internet each month. How many college
students must you survey to be 95% confident that your sample mean
is within 15 minutes of the population mean? Assume that the
standard deviation of the population of monthly time spent on the
Internet is 210 minutes.
In: Statistics and Probability