1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
serious [3.7K]
3 years ago
11

Given a variable temps that refers to a list, all of whose elements refer to values of type float , representing temperature dat

a, compute the average temperature and assign it to a variable named avg_temp . Besides temps and avg_temp , you may use two othervariables -- k and total .
My solution below didn't work. I wonder how to go about this problem.

temps = []

avg_temp = 0.0
total = 0.0

for k in range(temps):
total += k

avg_temp = total/len(temps)
Computers and Technology
1 answer:
VARVARA [1.3K]3 years ago
5 0

Answer:

The problem of the question code is as follows:

Explanation:

  1. There must be the items in the list: The above question code is in python language. The temps are a list type variable that is used to hold the collection of items or value. But in the above code, there is no item in the K list. So first remove this problem with the help of add the value on the list. There are two ways to add value to the list:- 1. Define the static list element by writing like "temps=[1.2,2.4,4.5]". and 2. Take input from the user and then add by "temps.append(item)".
  2. The syntax of the for loop: The syntax of the for loop is not right because it holds the "range" keyword which is written when we give the numeric value like, "for x in range(2)" or "for x in range(1,2)". So to correct for syntax the user needs to write "for k in temps:".

If the user removes the above-defined error from the code then the above code will run correctly

You might be interested in
A wireless access point is most like which other network device, in that all computers send signals through it to communicate wi
scZoUnD [109]

Answer:

Hub is the correct answer for the above question.

Explanation:

  • The hub is a network hardware device which can connect more computer with the network.
  • It has a multi-point which is used to connect multiple systems with the network or internet to share the information among them.
  • When any computer which is connected through this needs to communicate with the other computers on a network then it needs to send the signals to this device first then this device sends the signal to the other device.
  • The above question ask about that device which is used to connect the computer and send the signals to communicate which is a HUB which is described above.
3 0
4 years ago
Most programming languages provide loop statements that help users iteratively process code. In Coral you can write loops that h
AysviL [449]

Answer:

Explanation:

When programming loop statements are essential as they allow you to repeat a certain action various times without having to rewrite the same code over and over again for the number of times you want it to repeat. This drastically simplifies the code and saves on computer memory. Loop statements are written so that the same code repeats itself until a pre-set condition is met.

4 0
4 years ago
In which type of referencing do you get a warning message? Explain why.​
Art [367]

Answer:

These are the problems that are not severe enough to prevent processing. They mainly complain about the previous version of your document. In the case of command invalid, the latex gives a warning and henceforth it needs to be fixed.

Explanation:

There are some bugs in which they are not that severe that make the system not process.. but they are still mistakes in which might affect how the program run those parts.. like in JavaScript in the program i use, the minor bugs are like symbolized as yellow triangle and they are normally like signalizing a grammar error in the code and the app still runs but just that part of the code is invalid or reads wrong.. while big errors like codes that dont make sense, those make a red squareish that as soon as you try to run the program the debug console states in all red "Line 50(or whatever line) SyntaxError" or other things

5 0
3 years ago
Which of the following is an example of a Syntax Error?
quester [9]

Answer:

The correct answer is: "The program does not run at all."

Explanation:

The rules to write a program in any language are called syntax. The error in syntax of a language is called syntax error. Syntax errors are usually detected during the compilation of the program. The program cannot be run untill all syntax errors are removed.

So,

The correct answer is: "The program does not run at all."

7 0
3 years ago
Complete this truth Table. Write a program that you can enter from the keyboard, a 1 or 0 into three Boolean variables, A,B,C. W
SSSSS [86.1K]

Answer:

Following are the code to this question:

#include<stdio.h>//defining header file

int AND(int x,int y) //defining a method AND that hold two variable in its parameter

{

if(x==1 && y==1)//defining if block to check x and y value is equal to 1

{

return 1;//return value 1

}

else //defining else block

{

   return 0;//return value 0

}

}

int OR(int x,int y)//defining method OR that hold two variable in its parameter

{

if(x==0&&y==0)//defining if block to check x and y value is equal to 1

{

return 0;//return value 0

}

else //defining else block

{

   return 1;//return value 1

}

}

int main()//defining main method

{

int a,b,c;//defining integer variable  

int k=1;//defining integer variable k that holds a value 1

while(k<=8)//defining while loop for 8 time input

{

printf("Please insert 3 numbers in (0 0r 1):\n ");//print message

scanf("%d%d%d", &a, &b, &c);//input value

k++;//increment the value of k by 1

printf("value: %d\n",AND(OR(a,b),c));

}

return 0;

}

Output:

please find the attachment.

Explanation:

In the above-given C language code two methods "AND and OR" is declared, holds two integer variable "x and y" in its parameters, inside the method a conditional it used that can be defined as follows:

  • In the AND method, inside a conditional statement, if block check x and y both value is same that is 1 it will return 1 or it will goto else block in this it will return value 0.      
  • In the OR method, inside a conditional statement, if block check x and y both value is the same, that is 0 it will return 0 or it will goto else block in this it will return value 1.
  • In the main method, four integers "a,b,c, and k" is declared in which variable "a, b, c" is used in the loop for 8 times input values from the user and print method is used to call the method and prints its return values.

8 0
3 years ago
Other questions:
  • The analysis of how people relate to each other is known as?
    6·1 answer
  • When enter a function or formula in a cell, which is the character you must type?
    14·1 answer
  • I need help plz it keeps on happening and idk what to do
    12·1 answer
  • A statement that highlights an organization's key ethical issues and identifies the overarching values and principles that are i
    6·1 answer
  • Brad is joining a big website design firm. He is worried that he may not be able to adapt to the company culture. What can he do
    15·1 answer
  • Write a Java program in jGRASP that creates a 2D integer array of 5 rows and 20 columns, fills it with increasing integer values
    13·1 answer
  • A certain computer game is played between a human player and a computer-controlled player. Every time the computer-controlled pl
    8·1 answer
  • A great way to obtain Hands-On training in a real quick environment is to complete a ??
    12·1 answer
  • PLEASE HURRY! Match terms in the first column with the order descriptions in column two.
    12·1 answer
  • Write a python program to calculate the sum of three numbers and as well require the user to input the numbers.​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!