You are to create a program using Python that asks the user for a nonnegative number, then computes the mean and variance using the above given online update formulas which should be displayed on the console screen. The program should end when a user enters a negative number.

Answers

Answer 1

Answer:

# In the new version of python is available the functions mean() an variance()

# In the module of statistics

i = 0 #Var to input the elements

l = [] #Var to store the elements on a list

while(i>0):

    print("In put a positive number to add in the list or negative to exit ")

    i = input()

    l.append(i)

    print("The mean of the all elements is: " + mean(l) )

    print("The variance of the all elements is: " + variance(i) )

Explanation:

At present, you can use in the news python's verison e.g. (python 3.7) the statistics module and use functions like mean(), variance(), stdev() and many others.

In the first step you create two variables, i to recieve the inputs of a loop and l to store all the elements recieved in the i variable. after that you pass as an argument the list that you stored before and get the mean() and variance() of the all elements in the list.

I hope it's help you.


Related Questions

When used as parameters, _________ variables allow a function to access the parameter’s

original argument.

Answers

Answer:  reference

Explanation:

In an function if the variables are passed as reference variables this means that the variables are pointing to the original arguments.So the changes made in the function on the reference variables will be reflected back on the original arguments.

For example:-

#include<iostream>

using namespace std;

void swap(&int f,&int s)

{

    int t=f;

    f=s;

   s =temp;

}

int main()

{

int n,m;

n=45;

m=85;

swap(n,m);

cout<<n<<" "<<m;

return 0;

}

the values of m and n will get swapped.

#include<iostream>

using namespace std;

void swapv(int f,int s)

{

    int t=f;

    f=s;

    s=temp;

}

int main()

{

int n,m;

n=45;

m=85;

swapv(n,m);

cout<<n<<" "<<m;

return 0;

}

In this program the values of m and n will not get swapped because they are passed by value.So duplicate copies of m and n will be created and manipulation will be done on them.

. What happens when you serialize an object? What happens when you deserialize an object?

Answers

Answer: serialize means to convert a java object to  byte stream and deserialize means to  convert the byte stream again to java object.

Explanation:

Both of these functions are present in  java.io library. we perform serviceable to java object in order to send it across the network where we can it can be stored in the hard disk because java object cannot be sent across the network to be stored in hard disks. Similarly deserialize enable to get the java object from the byte stream across  the network

In the STL container list, the functionpop_front does which of the following?

a. inserts element at the beginning of the list

b. inserts element at the end of the list

c. returns the first element

d. removes the last element from the list

Answers

Answer: Returns the first element

Explanation:

The functionpop_front always gives us the first element as it removes the first element from the front of the list.

Database applications are seldom intended for use by a single user.

A.

True

B.

False

Answers

Answer:

false

Explanation:

When a function uses a mixture of parameters with and without default arguments,

the parameters with default arguments must be defined _________.

Answers

Answer: after the required parameters.

Explanation:

Default arguments in a function should be defined after the required parameters because the required parameters are necessary but default arguments are not. If mixed parameters are allowed it will be very hard for the compiler to to judge which value matches which argument so there will be syntax error.

Convot the following biliary number into decimal form using any method ? (1010.100)2

Answers

Answer:

10.5

Explanation:

1010.1

Handy method you can find searching google images, and I originally learned

from some guy teaching an online java course.

.1 --> 1 * 2^(-1) = 0.5

0 --> 0 * 2^(0) = 0

1 --> 1 * 2^(1) = 2

0 --> 0 * 2^(2) = 0

1 --> 1 * 2^(3) = 8

0.5 + 2 + 8 = 10.5

If for some reason it isn't very clear, just take the number, (x) and multiply it

by two to the power of the position it is in. (e.g. first number before decimal point is 0, second 1, etc).

Define the following variables (in a new file and a new main() function):
• Integer value a and b
• Pointer variable p and q (pointers to integer values)
• Set the value of a to 5 and value of b to 7
• Set p to point to a and q to point to b (in other words assign the address of variables to pointers)

Answers

Answer:

#include<stdio.h>

int main()//driver function

{

int a=5;//initializing variable a

int b=7;//initializing variable b

int *p,*q;//declaring pointers p and q

p=&a;//assigning the address of a to p

q=&b;//assigning the address of b to q

printf("value of a is %d\n",a);

printf("value of b is %d\n",b);

printf("value of pointer p is %d\n",*p);

printf("value of pointer q is %d\n",*q);  

printf("address of a is %d\n",&a);

printf("address of b is %d\n",&b);

return 0;

}

Output

value of a is 5

value of b is 7

value of pointer p is 5

value of pointer q is 7

address of a is -783856608

address of b is -783856604

What is the computer virus?

Answers

a piece of code which is capable of copying itself and typically has a detrimental effect, such as corrupting the system or destroying data.

computer virus can be defined as a malicious program that self replicates by copying itself to another program, in other words, the computer virus spreads by itself into order executable code or documents.

The resources assigned to them will significantlyinfluences the duration of most activities.

True
False

Answers

Explanation:

Assigned to whom? what resources??

Write a C++ program that reads four double precision numbersfrom the screen using the variables x1,x2,x3 and x4. The programthen adds them together multiplies the sum by the quantityx1*x2*x3*x4 and then prints the final result to the screen withappropriate label.

Answers

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

  double x1,x2,x3,x4,sum,output;//declaring variables..

  cout<<"Enter the variables"<<endl;

  cin>>x1>>x2>>x3>>x4;//taking input of the time...

  sum=x1+x2+x3+x4;//calculating the sum...

  output=sum*x1*x2*x3*x4;

  cout<<"The asnwer is "<<output<<endl;//printing the temperature..

return 0;

}

Explanation:

I have taken 6 double variables sum to hold the sum of variables and output is to hold the answer.Then calculating printing the output.

We can include following item(s) during configuration itemidentification:

a) User Manuals andDocumentations

b) Source Code

c) Software RequirementSpecifications

d) All of the above

Answers

Answer:

d) All of the above

Explanation:

In configuration management, the Identify configuration items, work products and related components are present.

All the documents which are related to the work,the manuals how that the system works are present in the configuration item identification.The source code that is implement for the functioning of the products.These are implemented at the time of generation of products.Software Requirement Specifications are also specified by SRS it is present in design stage of software development life cycle,it is also a part of configuration item identification.

A jeweler designing a pin has decided to use five stones chosen from diamonds, rubies, and emeralds. In how many ways can the stones be selected?

Answers

Answer:

3,125 different possible ways

Explanation:

Great question, hopefully i can shed some light on the situation. There are a total of 5 stones. One by one they are randomly picked out of the bag. We need to find how many possible combinations there are for picking the stones out of the bag. We can solve this by raising the amount of stones in the bag to its own power like so,

[tex]5^{5} =  3,125[/tex]

So now we can see there are 3,125 different possible ways of selecting the stones.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

With theuse of which of the following, we reason from a generalization to aspecific conclusion?

a- Analogy

b- Logic

c- Induction

d- Deduction

Answers

Answer:

d-Deduction

Explanation:

Deduction

In deductive inference, we maintain a hypothesis and we predict its implications on the basis of it. That is, we predict what the results should be if the theory were right. We go from the general theory to the particular observations.

Induction

We're going from the specific to the general inductive inference. We make a lot of observations, discern a pattern, generalize and infer an explanation or theory.

Analogy

An analogy is a comparison between two objects or object systems, highlighting the respects in which they are considered to be similar.

Logic

Science dealing with the principles and criteria of validity of inference and demonstration that is science of formal rules of reasoning.

When askingfor a raise, which one among the following is important toremember?

a- Effort is to berewarded

b- Non-cash benefits may beof value if a raise is not feasible

c- The length of employmentis a great bargaining tool in asking for araise

d- Emotional appeals canhelp in getting a positive response to therequest

Answers

Answer:

a-Effort is to be rewarded

Explanation:

When you ask for a raise in an organization,the one of the most important thing is Effort.There is a reason for everything in organization,if you are asking to raise your income organization will ask you on which basis you are asking.If you put extra hours than before or you gain some skill which is useful for the organization,so while asking for raise you should know the effort that you put in because effort is most important factor for a raise.

In formal organizations, Non cash benefits are not there so there is no purpose for asking it.

Employment does not matter for the peer in asking for a raise,sometimes it is used by small organizations but it is informal,the one should focus more on effort rather than the employment.

Emotional appeals may help in informal organization,never in formal organization.It only imprints negative image on peer's mind,if you want to have a raise you should focus on Effort.    

You can initialize more than one variable in a for loop by placing a(n) ____ between the separate statements.

a.
equal sign

b.
comma

c.
period

d.
semicolon

Answers

Answer:

comma

Explanation:

The for loop is used to execute the specific statement again and again until the condition is false.

The syntax:

for(initialization;condition;increment/decrement)

{

  statement;

}

In the initialization, we an initialize more than one variable by using the 'comma' as separator.

similarly for condition and increment/decrement part as well.

for example:

for(int x = 0,y = 0;x<5,y<5;x++,y++)

{

  statement;

}

we can used as many as possible by using comma

___ defines a series of standards for encoding audio and video in digital form for storage or transmission. Most of these standards include compression, often lossy compression.

a) JPEG b) ANSI c) ISO d) MPEG

Answers

Answer:

d) MPEG

Explanation:

MPEG stands for Moving Picture Experts Group.

It defines standards for audio and video compression on digital form for storage and transmission.

JPEG (Joint Photographic Experts Group)ANSI (American National Standards Institute)ISO ( International Organization for Standardization)

are also international standards but they are not related to dogotal video compression.

types ofsecurity(hardware-software-both)??

Answers

Answer:

There are two types of security:

Hardware security: A hardware security is defined as, it is a physical computing device which help in managing the digital path for strong authentication and provides processing the module. It is used to monitor the traffic and used in scanning the system.

Software security: Software security is a type of software which helps in secure a network and computer devices. It manages access control and provides the data protection of the system and defend from other system security risks.  

SQL commands can be classified into three types. Which isNOT an SQL command type?
1 DDL

2 DML

3 DGL

4 DCL

Answers

Answer:

DGL

Explanation:

SQL stands for structured query language which is used to interface with the database.

Let discuss the options:

1. DDL: This comes in the category of SQL and it stands for data definition language. This allows using CREATE, DELETE, DROP, ALTER, etc. of the table in the database.

2. DML: This comes in the category of SQL and it stands for data manipulation

language. This allows the user to use the INSERT, DELETE, UPDATE command which help to manipulate the data in the table.

3. DGL: This is not a part of SQL.

4. DCL: This comes in the category of SQL and it stands for data control language which allows the user to use ALTER PASSWORD, GRANT, REVOKE like command which helps the user to control access the data in the database.

Therefore, the correct answer is DGL.

Forwarded events can only be recorded when systems ADMINISTRATORS have de-established an event subscription. TRUE or FALSE

Answers

Answer:

True

Explanation:

Forwarded events can only be recorded when systems administrators have de-established an event subscription.

Instructions
Write a program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number. (Note: An even number is prime if it is 2. An odd integer is prime if it is not divisible by any odd integer less than or equal to the square root of the number.)

Answers

Answer: The c++ program to determine if the input number is prime is given below.

#include<iostream>

#include<math.h>

using namespace std;

int main() {

   int num, n;

   int prime=0;

   int i=3;

   cout<<"This program determines whether the number is prime." <<endl;

   do

   {

       cout<<"Enter any positive number."<<endl;

       cin>>num;

       if(num<=0)

           cout<<"Invalid input. Enter any positive number."<<endl;

   }while(num<=0);

   n=sqrt(num);

   if((num==1)||(num==2))

   {

       cout<<"The input "<<num<<" is prime."<<endl;

   }

   else if(num%2==0)

   {

       cout<<"The input "<<num<<" is not prime."<<endl;

   }

   else

   {

       do

       {

           if(num%i == 0)

               prime += 1;

           

           i++;

       }while(i<n);

        if(prime>1)

           cout<<"The input "<<num<<" is not prime."<<endl;

        else  

           cout<<"The input "<<num<<" is prime."<<endl;

   }

   return 0;

}

OUTPUT

This program determines whether the number is prime.

Enter any positive number.

-9

Invalid input. Enter any positive number.

Enter any positive number.

0

Invalid input. Enter any positive number.

Enter any positive number.

47

The input 47 is prime.

Explanation: This program accepts numbers beginning from 1. Any number less than 1 is considered as invalid input.

The test for prime is done using multiple if-else statements.

If number is even, it is not prime. Any number divisible by 2 is an even number. Except 2, it is even but also prime since it is divisible by itself only.

For odd numbers, number is divided by all odd numbers beginning from 3 till square root of the input. We first calculate and store square root of input.

n=sqrt(num);

An integer variable prime is initialized to 0. This variable is incremented each time the number is divisible by other number.

   int prime=0;

do

       {

           if(num%i == 0)

               prime += 1;            

           i++;

       }while(i<n);

Since prime number is only divisible by itself, all the prime numbers undergo this condition and hence, value of prime variable becomes 1.

The 0 and 1 values of variable prime indicate prime number. Other greater values indicate input is not prime.

if(prime>1)

           cout<<"The input "<<num<<" is not prime."<<endl;

        else  

           cout<<"The input "<<num<<" is prime."<<endl;

Python program checks if a positive integer is prime; uses a separate function to perform the primality test.

Here's a Python program that prompts the user to input a positive integer and then outputs a message indicating whether the number is a prime number:

```python

import math

def is_prime(n):

   if n <= 1:

       return False

   if n == 2:

       return True

   if n % 2 == 0:

       return False

   max_divisor = math.isqrt(n)

   for i in range(3, max_divisor + 1, 2):

       if n % i == 0:

           return False

   return True

def main():

   num = int(input("Enter a positive integer: "))

   if is_prime(num):

       print(f"{num} is a prime number.")

   else:

       print(f"{num} is not a prime number.")

if __name__ == "__main__":

   main()

```

Explanation:

1. The `is_prime` function checks whether the given number `n` is a prime number.

2. It first checks if the number is less than or equal to 1, in which case it returns False.

3. It then handles the case for the number 2 separately, as it is a prime number.

4. For odd numbers greater than 2, it iterates through odd divisors up to the square root of the number to check for divisibility.

5. If the number is divisible by any of these odd divisors, it returns False; otherwise, it returns True.

6. In the `main` function, the user is prompted to input a positive integer, and the result of the `is_prime` function is printed accordingly.

What is the value of the following expression? (false || (4-3 && 6))

true

false

0

illegal syntax

Answers

Answer:

true

Explanation:

The operator '||' is called the OR operator. it is used in between the two Boolean values.

OR operator has four possible values:

First Boolean is TRUE and second Boolean is TRUE, result will be TRUE.

First Boolean is TRUE and second Boolean is FALSE, result will be TRUE.

First Boolean is FALSE and second Boolean is TRUE, result will be TRUE.

First Boolean is FALSE and second Boolean is FALSE, result will be FALSE.

consider the expression:

(false || (4-3 && 6))

the second expression (4-3 && 6) gives Boolean TRUE, because their is no point for condition false.

so, (false || True) gives TRUE result.

Final answer:

False. The expression (false || (4-3 && 6)) will result in false because the '&&' operator takes precedence over '||', and 4-3 evaluates to 1 which is considered 'true' in Boolean logic.

Explanation:

The value of the expression (false || (4-3 && 6)) is true. In this expression, ((4-3 && 6)) is evaluated first. Since 4-3 is 1, which is true, and 6 is also a non-zero number, which is considered true, the result of that part of the expression is true because both operands are true for the && (AND) operator. Then we have 'false || true', and since '||' is the OR operator, the expression is true if either side is true. Hence, the entire expression evaluates to true.

briefly describe the software quality dilemma in your own words

Answers

Answer:

 software quality dilemma is a situation where there is confusion regarding what should we prioritize : a good quality work or a fast paced work. In software development , many a times there will be deadlines to achieve, in such cases software quality dilemma is bound to occur. A developer would have to choose between writing and optimized and well commented code or just get the job done without proper optimized or reviews. In same lines, many companies have to decide between regular reviews and expert opinions of a product for good software quality or bypass them to meet budgets and deadlines.

In short, a software quality dilemma means a situation of production of software system that has terrible quality which causes low sales.

A software quality dilemma refers to a situation where there is a confusion regarding what should we prioritize whether a good quality work or a fast paced work with little quality,

In conclusion, in a software development, there are usually deadlines to achieve a software creation and this is one of the cause of software quality dilemma.

Read more about quality dilemma

brainly.com/question/13171394

What is the Moore's law

Answers

Answer:

Hi, in the law of Moore we can express aproxitmaly for each two years is duplicated the number of transitors in a microprocessor.

Explanation:

In around 26 years the number of transitors has increased about 3200 times, a transitor is a way to regulate the current voltage flow and can be act like a switch for an electronic signal.

I hope it's help you.

Answer:

The power of microprocessors would double every two years

Explanation:

Develop a program that will calculate the area and perimeter of a rectangle. The length and width can be given as constant.(LENGTH= 8 WIDTH=8).

Answers

Answer:

#include <iostream>

using namespace std;

int main()

{

 

  int length = 8;

  int width = 8;

 

  int perimeter = 2*(length + width);

  int area = length * width;

 

  cout<<"The perimeter is "<<perimeter<<endl;

  cout<<"The area is "<<area<<endl;

 

  return 0;

}

Explanation:

include the library iostream for using the input/output instructions in the c++ programming.

Create the main function and define the variable length and width with values.

Then, use the formula for calculating the perimeter and area of rectangle.

[tex]perimeter = 2*(length + width)[/tex]

[tex]area = length * width[/tex]

and store in the variables and finally print the output.

The syntax for accessing a class (struct) member using the operator -> is ____.

A.
pointerVariableName.classMemberName

B.
pointerVariableName->classMemberName

C.
&pointerVariableName.classMemberName

Answers

Answer: pointerVariableName->classMemberName

Explanation:

Here the pointerVariableName can be used to access a classMemberName. This ca also be written as (*pointerVariableName).classMemberName.

Answer:

B. pointerVariableName->classMemberName

Explanation:

The syntax for accessing a class (struct) member using the operator -> is pointerVariableName->classMemberName.

Built-in user accounts include only the Administrator account created during Windows installation True False

Answers

Answer: True

Explanation:

When an OS is installed, the first account created is the built -in user account. It is the administrator account for the purpose of recovery and to facilitate the set up.

The statement is false; there are several built-in user accounts in Windows besides the Administrator account, including Guest, System, and service accounts such as Network Service and Local Service.

The statement that built-in user accounts in Windows include only the Administrator account created during Windows installation is false. Windows operating systems usually come with several predefined accounts for system management and security purposes.

Beyond the Administrator account, there is also the 'Guest' account, which is normally disabled by default but designed for users who require temporary access to the computer. Moreover, there is the 'System' account, which is used by the operating system to manage system services and the 'Network Service' and 'Local Service' accounts which have specific privileges to run particular system services without requiring the full privileges of the Administrator account.

These built-in accounts are an essential part of Windows security management, with each serving different roles and representing different levels of access permissions within the operating system.

If you want to stop a loop before it goes through all its iterations, the break statement may be used.



True False

Answers

Final answer:

The break statement is utilized to stop a loop prematurely in programming by exiting the loop before all iterations are completed.

Explanation:

The break statement in programming is used to stop a loop before it completes all its iterations. If the condition for the loop is True, the loop will keep running until the break statement is encountered, which then exits the loop.

Using a break statement helps in controlling the flow of the loop and is particularly useful in scenarios where you need to exit a loop prematurely based on certain conditions.

By strategically placing the break statement within a loop, you can efficiently manage when the loop should terminate, preventing it from running indefinitely.

_________ local variables retain their value between function calls.

Answers

Answer: static

Explanation:

variables when declared static gets called statically meaning whenever a function call is made it get stored and it is not required to get the variable again when the function is again called. There scope is beyond the function block

______ are used to store all the data in a database.

A. Forms
B. Tables
C. Fields
D. Queries

Answers

Answer:

C. Fields

Explanation:

Fields are used to store all the data in a database.

Fields are used to store all the data in a database. The correct option is C.

What is a database?

A database is a collection of data that has been organized to make it simple to manage and update. Data records or files containing information, including as sales transactions, customer information, financial data, and product information, are often aggregated and stored in computer databases.

A database field is a collection of identical data values in a table. It is also known as an attribute or a column. Most databases also permit complicated data storage in fields, including images, whole files, and even movie clips. A lot does not necessarily have simple text values just because it supports the same data type.

Therefore, the correct option is C. Fields.


To learn more about the database, refer to the link:

https://brainly.com/question/29412324

#SPJ6

The expression vecCont.empty() empties the vector container of all elements.

True

False

Answers

Answer:

False

Explanation:

Vector is a similar to dynamic array which has the ability to resize itself automatically.

empty() is a function used in the vector.

It is used to check the vector is empty or not.

it does not delete the element in vector, it just check the vector is empty or not, if vector empty it gives a Boolean value True other wise False.

Therefore, the answer is False.

Other Questions
Which of the following is an acceptable structure for 2,5,5-trimethylhept-3-yne (CH3CH2)CH(CH3)CCCH2CH(CH3)2 CH3CH2C(CH3)2CCC(CH3)3 (CH3CH2)2C(CH3)CCCH2CH3 (CH3CH2)C(CH3)2CCCH(CH3)2 (CH3CH2CH2)CH(CH3)CCC(CH3)3 Going up and down each isle in the grocery story to find milk is an example of what problem solving strategy? What language do the Persians in Iran speak?ArabicFrenchFarsiHindu What will $110,000 grow to be in 9 years if it is invested today at 11% A concrete piling of 50 kg is suspended from a steel wire of diameter 1.0 mm and length 11.2 m. How much will the wire stretch? modulus for steel is 20 x 10^10 N/m^2. The energy needed to keep a 75-watt lightbulb burning for 1.0 h is 270 kJ. Calculate the energy required to keep the lightbulb burning for 5.0 h in each of the following energy units. a) joules b) kilocalories A newly completed highway has a curve with a radius of 130 m and is banked at an angle of 24.8 degrees. What is the maximum speed that a minivan can have and still follow the curve safely under very icy conditions? Use the transforms in section 4.1 to find the Laplace transform of the function. t^3/2 - e^-10t The data below is from the Statistical Abstract of the United States located on the Internet specifically from tables in the section entitled "Foreign Commerce and Aid." One of the tables lists U.S. exports and imports by selected Standard Industrial Trade Classification (SITC) commodity. Complete the Net Export column in the table below:(Enter all values as integers. Remember to include a negative sign where appropriate.)Commodity Export Value Import Value Net Exports=Exports-Imports ($ millions) ($ millions) ($ millions)Coffee 4 3,237Corn 13,931 350Soybeans 15,455 182Airplanes 51,854 13,286Footwear 673 19,545Vehicles 98,871 190,799Crude Oil 2,270 353,537 if A and B are mutually exclusive events with P(A)= 0.3 and P(B)= 0.5, then P(A and B)= Tyreese is using algebra tiles to solve the equation below.2x + 5 = -x + (1)answers A. remove one x-tile from both sides. B. remove two x-tiles from the left side. C. add one positive x-tile to both sides. D. add two positive x-tiles to both sides. Suppose that in a lightning flash the potential difference between a cloud and the ground is 0.96109 V and the quantity of charge transferred is 31 C. (a) What is the change in energy of that transferred charge? (b) If all the energy released could be used to accelerate a 950 kg car from rest, what would be its final speed? 7.50 Draw all constitutional isomers with the molecular formula C4H9Br, and then arrange them in order of: (a) increasing reactivity toward an SN2 reaction. (b) increasing reactivity toward an E2 reaction What are the zeros of the function below? Check all that apply.F(x) =x(x-2)/(x+3)(x-5) Factor completely.5x^2 + 10x - 40 In most settings pharmacy technicians wear How did many Americans in the 1920s afford exclusive luxury items? (show the supposition, proof and conclusion)Use proof by contradiction to show that If a and b are rational numbers with b 0 and x is an irrational number, then a + bx is irrational. What does the line y = 2x + 5 look like? what is the intercept for the graph of this line? 5x -3y =11