Write the answers so we can answer your question
Write an expression that will cause the following code to print "Equal" if the value of sensorReading is "close enough" to targetValue. Otherwise, print "Not equal". Hint: Use epsilon value 0.0001. Ex: If targetValue is 0.3333 and sensorReading is (1.0/3.0), output is: Equal
Answer:
The expression that does the comparison is:
if abs(targetValue - sensorReading) < 0.0001:
See explanation section for full source file (written in Python) and further explanation
Explanation:
This line imports math module
import math
This line prompts user for sensor reading
sensorReading = float(input("Sensor Reading: ")
This line prompts user for target value
targetValue = float(input("Target Value: ")
This line compares both inputs
if abs(targetValue - sensorReading) < 0.0001:
print("Equal") This is executed if both inputs are close enough
else:
print("Not Equal") This is executed if otherwise
The expression that will cause the following code to print "Equal" if the value of sensorReading is "close enough" to targetValue and print "Not equal" if otherwise is as follows;
sensorReading = float(input("write your sensor reading: "))
targetValue = float(input("write your target value: "))
if abs(sensorReading - targetValue) < 0.0001:
print("Equal")
else:
print("not Equal")
The code is written in python.
Code explanationThe variable sensorReading is used to store the user's inputted sensor reading.The variable targetValue is used to store the user's inputted target value.If the difference of the sensorReading and the targetValue is less than 0.0001. Then we print "Equal"Otherwise it prints "not Equal"learn more on python code here; https://brainly.com/question/14634674?referrer=searchResults
For an alternative to the String class, and so that you can change a String's contents, you can use_________ .
a. char.
b. StringHolder.
c. StringBuilder.
d. StringMerger.
Answer:
c. StringBuilder
Explanation:
An alternative to the String class would be the StringBuilder Class. This class uses Strings as objects and allows you to mix and match different strings as well as adding, removing, implementing, and modifying strings themselves as though they were similar to an array. Unlike the string class StringBuilder allows you to modify and work with a combination of strings in the same piece of data as opposed to having various objects and copying pieces which would take up more memory.
You want to look up colleges but exclude private schools. Including punctuation, what would you
type?
O nonprofit college
O college -private
O private -college
O nonprofit -college
You want to look up colleges but exclude private schools. Including punctuation, The type is private -college. The correct option is c.
What are institutions of higher studies?The institutions for higher studies are those institutions that provide education after schooling. They are colleges and universities. Universities, colleges, and professional schools that offer training in subjects like law, theology, medicine, business, music, and art are all considered higher education institutions.
Junior colleges, institutes of technology, and schools for future teachers are also considered to be part of higher education. There are different types of colleges, like government colleges and private colleges. Private colleges are those which are funded by private institutions.
Therefore, the correct option is c. private -college.
To learn more about excluding, refer to the link:
https://brainly.com/question/27246973
#SPJ2
Write a program that finds the number of items above the average of all items. The problem is to read 100 numbers, get the average of these numbers, and find the number of the items greater than the average. To be flexible for handling any number of input, we will let the user enter the number of input, rather than fixing it to 100.
Answer:
Written in Python
num = int(input("Items: "))
myitems = []
total = 0
for i in range(0, num):
item = int(input("Number: "))
myitems.append(item)
total = total + item
average = total/num
print("Average: "+str(average))
count = 0
for i in range(0,num):
if myitems[i] > average:
count = count+1
print("There are "+str(count)+" items greater than average")
Explanation:
This prompts user for number of items
num = int(input("Items: "))
This creates an empty list
myitems = []
This initializes total to 0
total = 0
The following iteration gets user input for each item and also calculates the total
for i in range(0, num):
item = int(input("Number: "))
myitems.append(item)
total = total + item
This calculates the average
average = total/num
This prints the average
print("Average: "+str(average))
This initializes count to 0
count = 0
The following iteration counts items greater than average
for i in range(0,num):
if myitems[i] > average:
count = count+1
This prints the count of items greater than average
print("There are "+str(count)+" items greater than average")
what is the use of buffer?
Answer:
pH buffer or hydrogen ion buffer) is an aqueous solution consisting of a mixture of a weak acid and its conjugate base, or vice versa. ... Buffer solutions are used as a means of keeping pH at a nearly constant value in a wide variety of chemical applications.
Explanation:
there is your answer i got this one correct
hope it is helpful
Answer:
Limits the pH of a solution
Explanation:
A P E X
Explain why it is not necessary for a program to be completely free of defects before it is delivered to its customers?
Answer:
Testing is done to show that a program is capable of performing all of its functions and also it is done to detect defects.
It is not always possible to deliver a 100 percent defect free program
A program should not be completely free of all defects before they are delivered if:
1. The remaining defects are not really something that can be taken as serious that may cause the system to be corrupt
2. The remaining defects are recoverable and there is an available recovery function that would bring about minimum disruption when in use.
3. The benefits to the customer are more than the issues that may come up as a result of the remaining defects in the system.
Write (define) a function named count_down_from, that takes a single argument and returns no value. You can safely assume that the argument will always be a positive integer. When this function is called, it should print a count from the argument value down to 0.
Examples: count_down_from(5) will print 5,4,3,2,1,0, count_down_from(3) will print 3,2,1,0, count_down_from(1) will print 1,0,
Answer:
Written in Python
def count_down_from(n):
for i in range(n,-1,-1):
print(i)
Explanation:
This line defines the function
def count_down_from(n):
This line iterates from n to 0
for i in range(n,-1,-1):
This line prints the countdown
print(i)
Earned value:
How is it calculated?
What does the measurement tell you?
Answer:
Earned value is a measure which is used on projects to determine the value of work which has been completed to date, in order to understand how the project is performing on a cost and schedule basis. At the beginning of a project, a project manager or company will determine their budget at completion (BAC) or planned value (PV).
Explanation:
Write a function called matches that takes two int arrays and their respective sizes, and returns the number of consecutive values that match between the two arrays starting at index 0. Suppose the two arrays are {3, 2, 5, 6, 1, 3} and {3, 2, 5, 2, 6, 1, 3} then the function should return 3 since the consecutive matches are for values 3, 2, and 5.
Answer:
Written in C++
int matches(int arr1[], int arr2[], int k) {
int count = 0;
int length = k;
for(int i =0; i<length; i++) {
if(arr1[i] == arr2[i]) {
count++;
}
}
return count;
}
Explanation:
This line defines the function
int matches(int arr1[], int arr2[], int k) {
This line initializes count to 0
int count = 0;
This line initializes length to k
int length = k;
This line iterates through the array
for(int i =0; i<length; i++) {
The following if statement checks for matches
if(arr1[i] == arr2[i]) {
count++;
}
}
This returns the number of matches
return count;
}
See attachment for complete program
(d) Assume charArray is a character array with 20 elements stored in memory and its starting memory address is in $t5. What is the memory address for element charArray[5]?
Answer:
$t5 + 5
Explanation:
Given that ;
A character array defines as :
charArray
Number of elements in charArray = 20
Starting memory address is in $t5
The memory address for element charArray[5]
Memory address for charArray[5] will be :
Starting memory address + 5 :
$t5 + 5
What is the main purpose of software imaging?
a. to make compressed copies of complete systems
b. managing the project shift
c. photo distortion
d. software pirating
If the post office delivered mail exactly like the routers deliver messages on the Internet, which of the following statements would be true? (Choose all that apply)
Answer:
The mailman would sometimes take a different path to deliver each letter to your home.
Explanation:
Options:
The mailman would sometimes take a different path to deliver each letter to your home.
Letters would be written on the outside of envelopes for all to read instead of letters put inside envelopes.
Routers work in different ways and they take the fastest route no matter what is the direction they have to take, so they travel to several servers trying to find the fastest path to their destination, it changes almost everytime because of the use of servers and the conection speed of the different routes they can connect to, so that would be the option.
What is a service that allows the owner of a domain name to maintain a simple website and provide email capacity
Answer:
Domain name hosting
Explanation:
Domain name hosting or otherwise called web hosting, can be defined as a service that allows the owner of any domain name the capacity and ability to maintain any simple website or it's equivalent, also granting them the capability to provide email. This is important because most, of not all websites on the network, requires web service hosting. The most important job or work of domain name hosting is to make the website's address accessible through a user or client to directly type in the Uniform resource locator(URL) tab bar of the web browser making them access the website in an easy and efficient way.
Which query is used to list a unique value for V_CODE, where the list will produce only a list of those values that are different from one another?
a. SELECT ONLY V_CODE FROM PRODUCT;
b. SELECT UNIQUE V_CODE FROM PRODUCT;
c. SELECT DIFFERENT V_CODE FROM PRODUCT;
d. SELECT DISTINCT V_CODE FROM PRODUCT;
Answer:
d. SELECT DISTINCT V_CODE FROM PRODUCT;
Explanation:
The query basically lists a unique value for V_CODE from PRODUCT table.
Option a is incorrect because it uses ONLY keyword which does not use to list a unique value for V_CODE. Instead ONLY keyword is used to restrict the tables used in a query if the tables participate in table inheritance.
Option b is incorrect because it is a constraint that ensures that all values in a column are unique.
Option c is incorrect because DIFFERENT is not a keyword
Option d is correct because the query uses SELECT statement and DISTINCT is used to select only distinct or different values for V_CODE.
The query that should be used for a unique value is option d.
The following information should be considered:
The query listed the unique value for V_CODE arise from the PRODUCT table.Option A is wrong as it used ONLY keyword that does not represent the unique value. Option B is wrong as it is constraint where the columns values are considered to be unique.Option C is wrong as DIFFERENT does not represent the keyword. Option D is right as query applied SELECT and DISTINCT that represent different values.Therefore we can conclude that the correct option is D.
Learn more: brainly.com/question/22701930
The reading element punctuation relates to the ability to
pause or stop while reading.
emphasize important words.
read quickly yet accurately.
understand word definitions.
Answer:
A
Explanation:
Punctations are a pause or halt in sentences. the first one is the answer so do not mind the explanation.
semi colons, colons, periods, exclamation points, and question Mark's halt the sentence
most commas act as a pause
Answer: (A) pause or stop while reading.
Explanation:
Which of the following is often accessed in a browser but is not itself a browser feature or tool?
O history
add-ons
O bookmarks
webmail
Answer:
Webmail
Explanation:
Got it right on a test
Select content, click the Copy button, click the Paste button, and move the insertion point to where the content needs to be inserted.
Click the Copy button, select the content, move the insertion point to where the content needs to be inserted, and click the Paste button.
Select the content, click the Copy button, move the insertion point to where the content needs to be inserted, and click the Paste button.
Select the content, move the insertion point to where the content needs to be inserted, click the Copy button, and click the Paste button.
Answer:
what :)
Explanation:
Define a function called sum, for a given an array and an int representing its size, if the size is at least 3, then sum up all elements whose indices are a multiple of 3 and return that value, otherwise, return 0.
Answer:
Written in C++
int sum(int arr[], int size) {
int total = 0;
if(size>=3) {
for (int i = 0; i < size; ++i) {
if(i%3 == 0) {
total += arr[i];
}
}
}
return total;
}
Explanation:
This line defines the function
int sum(int arr[], int size) {
This line initializes sum to 0
int total = 0;
This line checks if size is at least 3
if(size>=3) {
This loop iterates through the array
for (int i = 0; i < size; ++i) {
The following adds multiples of 3
if(i%3 == 0) {
total += arr[i];
}
}
}
This returns the calculated sum
return total;
}
See attachment for full program
What is the output, if userVal is 5? int x; x = 100; if (userVal != 0) { int tmpVal; tmpVal = x / userVal; System.out.print(tmpVal); }
Answer:
The output is 20
Explanation:
This line divides the value of x by userVal
tmpVal = x / userVal;
i.e.
tmpVal = 100/5
tmpVal = 20
This line then prints the value of tmpVal
System.out.print(tmpVal);
i.e 20
Hence, The output is 20
Write a program that launches 1000 threads. Each thread adds 1 to a variable sum that initially is 0 (zero).
Answer:
The answer is below
Explanation:
Using Java programming language.
*//we have the following codes//*
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class My_Answer {
private static Integer sum = 0;
public static void main(String[] args) {
ExecutorService executor = Executors.newCachedThreadPool();
for (int i = 0; i < 1000; i++) {
executor.execute(new AddOne());
}
executor.shutdown();
while (!executor.isTerminated()) {
}
System.out.println("sum = " + sum);
}
private static class Add_Extra implements Runnable {
public void run() {
sum++;
}
}
}
Write a function addUpSquaresAndCubes that adds up the squares and adds up the cubes of integers from 1 to N, where N is entered by the user. This function should return two values - the sum of the squares and the sum of the cubes. Use just one loop that generates the integers and accumulates the sum of squares and the sum of cubes. Then, write two separate functions sumOfSquares and sumOfCubes to calculate and return the sums of the squares and sum of the cubes using the explicit formula below.
Answer:
All functions were written in python
addUpSquaresAndCubes Function
def addUpSquaresAndCubes(N):
squares = 0
cubes = 0
for i in range(1, N+1):
squares = squares + i**2
cubes = cubes + i**3
return(squares, cubes)
sumOfSquares Function
def sumOfSquares(N):
squares = 0
for i in range(1, N+1):
squares = squares + i**2
return squares
sumOfCubes Function
def sumOfCubes(N):
cubes = 0
for i in range(1, N+1):
cubes = cubes + i**3
return cubes
Explanation:
Explaining the addUpSquaresAndCubes Function
This line defines the function
def addUpSquaresAndCubes(N):
The next two lines initializes squares and cubes to 0
squares = 0
cubes = 0
The following iteration adds up the squares and cubes from 1 to user input
for i in range(1, N+1):
squares = squares + i**2
cubes = cubes + i**3
This line returns the calculated squares and cubes
return(squares, cubes)
The functions sumOfSquares and sumOfCubes are extract of the addUpSquaresAndCubes.
Hence, the same explanation (above) applies to both functions
How does a computer interact with its environment? How is data transferred on a real computer from one hardware part to another? Describe the importance of the human interaction in the computing system.
Answer:
Explanation:
A computer system can interact with its environment using hardware that does so such as cameras, robotic arms, thermometers, smart devices etc. These hardware devices gather information from the environment and transfer it to the computer system in a format known as bits through binary electrical impulses. If the system is designed to be autonomous then the only human interaction needed would be the initial setup of the system and its hardware, once this is done the system does not need any more human interaction as long as nothing breaks.
The following equations estimate the calories burned when exercising (source): Men: Calories = ( (Age x 0.2017) — (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184 Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Write a program with inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for men and women. Ex: If the input is 49 155 148 60, the output is:
In python:
age = float(input("How old are you? "))
weight = float(input("How much do you weigh? "))
heart_rate = float(input("What's your heart rate? "))
time = float(input("What's the time? "))
print("The calories burned for men is {}, and the calories burned for women is {}.".format(
((age * 0.2017) - (weight * 0.09036) + (heart_rate * 0.6309) - 55.0969) * (time / 4.184),
((age * 0.074) - (weight * 0.05741) + (heart_rate * 0.4472) - 20.4022) * (time / 4.184)))
This is the program.
When you enter 49 155 148 60, the output is:
The calories burned for men is 489.77724665391963, and the calories burned for women is 580.939531548757.
Round to whatever you desire.
The programming language is not stated. So, I will answer this question using Python programming language.
The program requires a sequence control structure, because it does not make use of conditions and iterations.
The program in python is as follows, where comments (in italics) are used to explain each line.
#This gets input for age, in years
age = int(input("Age (years): "))
#This gets input for weight, in pounds
weight = int(input("Weight (pounds): "))
#This gets input for heart rate, in beats per minutes
heart_rate = int(input("Heart Rate (beats per minutes): "))
#This gets input for time, in minutes
time = int(input("Time (Minutes) : "))
#This calculates the calories burnt for men
Men = ((age * 0.2017) - (weight * 0.09036) + (heart_rate * 0.6309) - 55.0969) * time / 4.184
#This calculates the calories burnt for women
Women = ((age * 0.074) - (weight * 0.05741) + (heart_rate * 0.4472) - 20.4022 ) * time / 4.184
#This prints the calories burnt for men
print("Men:", Men)
#This prints the calories burnt for women
print("Women:", Women)
At the end of the program, the program outputs the amount of calories burnt for men and women.
See attachment for sample run
Read more about Python programs at:
https://brainly.com/question/22841107
Documents files should be saved as a _____ file
Answer:
Explanation:
Write a function that takes in a sequence s and a function fn and returns a dictionary. The values of the dictionary are lists of elements from s. Each element e in a list should be constructed such that fn(e) is the same for all elements in that list. Finally, the key for each value should be fn(e)
def group_by(s, fn):
""" >>> group_by([12, 23, 14, 45], lambda p: p // 10)
{1: [12, 14], 2: [23], 4: [45]}
>>> group_by(range(-3, 4), lambda x: x * x)
{0: [0], 1: [-1, 1], 4: [-2, 2], 9: [-3, 3]}
"""
Use Python
Answer:
Here is the Python function:
def group_by(s, fn): #method definition
group = {} #dictionary
for e in s: #for each element from s
key = fn(e) #set key to fn(e)
if key in group: #if key is in dictionary group
group[key].append(e) #append e to the group[key]
else: #if key is not in group
group[key] = [e] #set group[key] to [e]
return group #returns dictionary group
Explanation:
To check the working of the above function call the function by passing a sequence and a function and use print function to display the results produced by the function:
print(group_by([12, 23, 14, 45], lambda p: p // 10))
print(group_by(range(-3, 4), lambda x: x * x))
function group_by takes in a sequence s and a function fn as parameters. It then creates an empty dictionary group. The values of the dictionary are lists of elements from s. Each element e in a list is constructed such that fn(e) is the same for all elements in that list. Finally, the key for each value is fn(e). The function returns a dictionary. The screenshot of the program along with its output is attached.
WILL GIVE BRAINIEST! Your users are young children learning their arithmetic facts. The program will give them a choice of practicing adding or multiplying. You will use two lists of numbers. numA = [4, 1, 6, 10, 2, 3, 7, 9, 11, 12, 5, 8]. numB = [2, 12, 10, 11, 1, 3, 7, 9, 4, 8, 5, 6]. If the user chooses adding, you will ask them to add the first number from each list. Tell them if they are right or wrong. If they are wrong, tell them the correct answer. Then ask them to add the second number in each list and so on. If the user chooses multiplying, then do similar steps but with multiplying. Whichever operation the user chooses, they will answer 12 questions. Write your program and test it on a sibling, friend, or fellow student.
In python:
numA = [4, 1, 6, 10, 2, 3, 7, 9, 11, 12, 5, 8]
numB = [2, 12, 10, 11, 1, 3, 7, 9, 4, 8, 5, 6]
while True:
i = 0
userChoice = input("Adding or Multiplying? (a/m) ")
if userChoice == "a":
while i < len(numA):
answer = int(input("What is {} + {} ".format(numA[i],numB[i])))
if answer == numA[i] + numB[i]:
print("Correct!")
else:
print("That's incorrect. The right answer is {}".format(numA[i] + numB[i]))
i += 1
elif userChoice == "m":
while i < len(numA):
answer = int(input("What is {} * {} ".format(numA[i], numB[i])))
if answer == numA[i] * numB[i]:
print("Correct!")
else:
print("that's incorrect. The right answer is {}".format(numA[i] * numB[i]))
i += 1
The program will give them a choice of practicing adding or multiplying is true.
What is computer program?Computer program is defined as a series of instructions written in a programming language that a computer may follow. Computers can obey a set of instructions created through coding. Programmers can create programs, including websites and apps, by coding.
Python says:
numA = [4, 1, 6, 10, 2, 3, 7, 9, 11, 12, 5, 8]
numB = [2, 12, 10, 11, 1, 3, 7, 9, 4, 8, 5, 6]
though True:
I = 0
input("Adding or Multiplying? (a/m)") userChoice
when userChoice equals "a"
even when I = len(numA):
What is input("What is + ".format(numA[i],numB[i]))? answer = int
if response == numA[i] + numB[i]:
print("Correct! ")
else:
print( "That is untrue. The appropriate response is "Formatted as (numA[i] + numB[i])
I += 1
if userChoice == "m," then
even when I = len(numA):
answer = int("What is *? ".format(numA[i], numB[i]))
if the response equals numA[i] + numB[i]:
print("Correct! ")
else
print( "that is untrue. The appropriate response is ".format(numB * numA[i]
I += 1
Thus, the program will give them a choice of practicing adding or multiplying is true.
To learn more about program, refer to the link below:
https://brainly.com/question/11023419
#SPJ3
What does lurch mean
Answer:
lurch means make an abrupt, unsteady, uncontrolled movement or series of movements; stagger.
Answer:
uncontrolled movement or series of movements
Explanation:
There is a company of name "Baga" and it produces differenty kinds of mobiles. Below is the list of model name of the moble and it's price model_name Price reder-x 50000 yphone 20000 trapo 25000 Write commands to set the model name and price under the key name as corresponding model name how we can do this in Redis ?
Answer:
Microsoft Word can dohjr iiejdnff jfujd and
Microsoft Word can write commands to set the model name and price under the key name as corresponding model.
What is Microsoft word?One of the top programs for viewing, sharing, editing, managing, and creating word documents on a Windows PC is Microsoft Word. The user interface of this program is straightforward, unlike that of PaperPort, CintaNotes, and Evernote.
Word documents are useful for organizing your notes whether you're a blogger, project manager, student, or writer. Because of this, Microsoft Word has consistently been a component of the Microsoft Office Suite, which is used by millions of people worldwide.
Although Microsoft Word has traditionally been connected to Windows PCs, the program is also accessible on Mac and Android devices. The most recent version of Microsoft Office Word.
Therefore, Microsoft Word can write commands to set the model name and price under the key name as corresponding model.
To learn more about microsoft word, refer to the link:
https://brainly.com/question/26695071
#SPJ5
rray testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full credit is 100, so anything over 100 is extra credit. Ex: If testGrades
Answer:
Replace
/* Your solution goes here */
with
sumExtra = 0;
for (i =0; i<NUM_VALS;i++){
if(testGrades[i]>100){
sumExtra = sumExtra - testGrades[i] + 100;
}
}
Explanation:
This line initializes sumExtra to 0
sumExtra = 0;
The following is a loop from 0 to 3
for (i =0; i<NUM_VALS;i++){
The following if condition checks if current array element is greater than 100
if(testGrades[i]>100)
{
This line calculates the extra credit
sumExtra = sumExtra - testGrades[i] + 100;
}
}
See attachment for complete question
You are given an array of integers, each with an unknown number of digits. You are also told the total number of digits of all the integers in the array is n. Provide an algorithm that will sort the array in O(n) time no matter how the digits are distributed among the elements in the array. (e.g. there might be one element with n digits, or n/2 elements with 2 digits, or the elements might be of all different lengths, etc. Be sure to justify in detail the run time of your algorithm.
Answer:
Explanation:
Since all of the items in the array would be integers sorting them would not be a problem regardless of the difference in integers. O(n) time would be impossible unless the array is already sorted, otherwise, the best runtime we can hope for would be such a method like the one below with a runtime of O(n^2)
static void sortingMethod(int arr[], int n)
{
int x, y, temp;
boolean swapped;
for (x = 0; x < n - 1; x++)
{
swapped = false;
for (y = 0; y < n - x - 1; y++)
{
if (arr[y] > arr[y + 1])
{
temp = arr[y];
arr[y] = arr[y + 1];
arr[y + 1] = temp;
swapped = true;
}
}
if (swapped == false)
break;
}
}