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
Using the drop-down menus, correctly complete the sentences.
A(n)_____
is a set of step-by-step instructions that tell a computer exactly what to do.
The first step in creating a computer program is defining a(n)_____
the next step is creating a(n)______
problem that can be solved by a computer program.
A person writing a computer program is called a(n)
DONE
Answer:
I'm pretty sure these are right:
1. algorithm
2. problem
3. math
4. computer programmer
The collaborative team responsible for creating a film is in the process of creating advertisements for it and of figuring out how to generate excitement about the film. Which of the five phases of filmmaking are they most likely in?
Answer:
Distribution.
Explanation:
Filmmaking can be defined as the art or process of directing and producing a movie for viewing in cinemas or television. The process of making a movie comprises of five (5) distinct phases and these are;
1. Development.
2. Pre-production.
3. Production.
4. Post-production.
5. Distribution.
Distribution refers to the last phase of filmmaking and it is the stage where the collaborative team considers a return on investment by creating advertisements in order to have a wider outreach or audience.
In this scenario, the collaborative team responsible for creating a film is in the process of creating advertisements for it and of figuring out how to generate excitement about the film.
Hence, they are likely to be in the distribution phase in relation to the five phases of filmmaking.
Answer:
C: distribution
Explanation:
edg2021
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
Define a Python function named matches that has two parameters. Both parameters will be lists of ints. Both lists will have the same length. Your function should use the accumulator pattern to return a newly created list. For each index, check if the lists' entries at that index are equivalent. If the entries are equivalent, append the literal True to your accumulator. Otherwise, append the literal False to your accumulator.
Answer:
The function in Python is as follows:
def match(f1,f2):
f3 = []
for i in range(0,len(f1)):
if f1[i] == f2[i]:
f3.append("True")
else:
f3.append("False")
print(f3)
Explanation:
This line defines the function
def match(f1,f2):
This line creates an empty list
f3 = []
This line is a loop that iterates through the lists f1 and f2
for i in range(0,len(f1)):
The following if statement checks if corresponding elements of both lists are the same
if f1[i] == f2[i]:
f3.append("True")
If otherwise, this is executed
else:
f3.append("False")
This prints the newly generated list
print(f3)
Which online text source would include a review of a new TV show?
an academic journal
a blog
an e-book
an encyclopedia
Answer:
Blog
Explanation:
Online text sources include blogs, e-books, encyclopaedias, and e-zines. As a result, options A, B, C, and D are correct.
What is a text source?A source is a book or other material that contains the data that has been used, whereas a citation is the actual statement of the starting point. They were researchers who also worked as professors, writers, and other professionals, and they published books and articles.
Online text sources are those that can be accessed from anywhere and are available on the internet. The online text shows that anyone can see or exceed including blogs, e-books, encyclopaedias, and e-zines.
These are available for further studies and research. Also to give information this can be a source. Therefore, options A, B, C, and E is the correct option.
Learn more about text sources, here:
brainly.com/question/19131568
#SPJ6
Describe how to manage the workspace by putting each feature under the action it helps carry out
Answer:
Viewing Documents one at a time:Windows+tab keys,
Windows taskbar
Viewing documents at same time:
Snap,Arrange all
Explanation:
The workspace can be managed by putting control of the surroundings it's far important that you examine all of the factors and items found in your area.
What is the workplace for?Workspaces had been round in Ubuntu properly earlier than the transfer to Unity. They essentially offer you a manner to organization home windows associated with comparable duties together, in addition to get "additional" screenspace.
The subsequent step is to outline a logical and optimizing feature for the factors with a view to continuing to be on your surroundings, defining that each of them may be capable of carrying out an easy and applicable project for his or her paintings.
Read more about the workspace :
https://brainly.com/question/26463698
#SPJ2
(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
A hammer has an input distance of 9 cm and an output distance is 3 cm what is the ideal mechanical advantage
Answer:
1/3
Explanation:
The state way of grading drivers is called what?
*
What is a piece of information sent to a function
Answer:
the information sent to a function is the 'input'.
or maybe not hehe
Which line will be run?
A. The first line
B. The second
line
// 10 - 8 + 3
18 + 7 + 365
C. Both
D. Neither
Answer:
The answer to this question is given below in the explanation section.
Explanation:
The give code is:
// 10 - 8 + 3
18 + 7 + 365
the given lines of code, if you run it as it is given in the question then the answer is D. Because these lines will run by the compiler but give an error because these lines are not properly written.
However, if we consider, that these lines of codes are correct then the second line will run and the first line will not run because the first line is a comment. Before the beginning of the first line, there is a "//" that shows a comment line. it is a singal line comment and the compiler will not run the comment line.
Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both single words. Then the program outputs last name, comma, first name. End with newline. Example output if the input is: Maya Jones Jones, Maya
Answer:
Written in Python:
import re
name = input("Name: ")
print(re.sub("[ ]", ", ", name))
Explanation:
This line imports the regular expression library
import re
This line prompts user for input
name = input("Name: ")
This line replace the space with comma and prints the output
print(re.sub("[ ]", ", ", name))
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.
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
In this exercise you will debug the code which has been provided in the starter file. The code is intended to take two strings, s1 and s2 followed by a whole number, n, as inputs from the user, then print a string made up of the first n letters of s1 and the last n letters of s2. Your job is to fix the errors in the code so it performs as expected (see the sample run for an example).
Sample run
Enter first string
sausage
Enter second string
races
Enter number of letters from each word
3
sauces
Note: you are not expected to make your code work when n is bigger than the length of either string.
1 import java.util.Scanner;
2
3 public class 02_14_Activity_one {
4 public static void main(String[] args) {
5
6 Scanner scan = Scanner(System.in);
7
8 //Get first string
9 System.out.println("Enter first string");
10 String s1 = nextLine(); 1
11
12 //Get second string
13 System.out.println("Enter second string");
14 String s2 = Scanner.nextLine();
15
16 //Get number of letters to use from each string
17 System.out.println("Enter number of letters from each word");
18 String n = scan.nextLine();
19
20 //Print start of first string and end of second string
21 System.out.println(s1.substring(1,n-1) + s2.substring(s1.length()-n));
22
23
24 }
Answer:
Here is the corrected program:
import java.util.Scanner; //to accept input from user
public class 02_14_Activity_one { //class name
public static void main(String[] args) { //start of main method
Scanner scan = new Scanner(System.in); //creates Scanner class object
System.out.println("Enter first string"); //prompts user to enter first string
String s1 = scan.nextLine(); //reads input string from user
System.out.println("Enter second string"); //prompts user to enter second string
String s2 = scan.nextLine(); //reads second input string from user
System.out.println("Enter number of letters from each word"); //enter n
int n = scan.nextInt(); //reads value of integer n from user
System.out.println(s1.substring(0,n) + s2.substring(s2.length() - n ));
} } //uses substring method to print a string made up of the first n letters of s1 and the last n letters of s2.
Explanation:
The errors were:
1.
Scanner scan = Scanner(System.in);
Here new keyword is missing to create object scan of Scanner class.
Corrected statement:
Scanner scan = new Scanner(System.in);
2.
String s1 = nextLine();
Here object scan is missing to call nextLine() method of class Scanner
Corrected statement:
String s1 = scan.nextLine();
3.
String s2 = Scanner.nextLine();
Here class is used instead of its object scan to access the method nextLine
Corrected statement:
String s2 = scan.nextLine();
4.
String n = scan.nextLine();
Here n is of type String but n is a whole number so it should be of type int. Also the method nextInt will be used to scan and accept an integer value
Corrected statement:
int n = scan.nextInt();
5.
System.out.println(s1.substring(1,n-1) + s2.substring(s1.length()-n));
This statement is also not correct
Corrected statement:
System.out.println(s1.substring(0,n) + s2.substring(s2.length() - n ));
This works as follows:
s1.substring(0,n) uses substring method to return a new string that is a substring of this s1. The substring begins at the 0th index of s1 and extends to the character at index n.
s2.substring(s2.length() - n ) uses substring method to return a new string that is a substring of this s2. The substring then uses length() method to get the length of s2 and subtracts integer n from it and thus returns the last n characters of s2.
The screenshot of program along with its output is attached.
This assignment requires you to write a well documented Java program to calculate the total and average of three scores, the letter grade, and output the results. Your program must do the following:
Prompt and read the users first and last name
Prompt and read three integer scores
Calculate the total and average
Determine a letter grade based on the following grading scale - 90-100 A; 80-89.99 B; 70-79.99 C; below 70 F
Use the printf method to output the full name, the three scores, the total, average, and the letter grade, properly formatted and on separate lines.
Within the program include a pledge that this program is solely your work and the IDE used to create/test/execute the program. Please submit the source code/.java file to Blackboard. Attached is a quick reference for the printf method.
Answer:
The solution is given in the explanation section
Don't forget to add the pledge before submitting it. Also, remember to state the IDE which you are familiar with, I have used the intellij IDEA
Follow through the comments for a detailed explanation of each step
Explanation:
/*This is a Java program to calculate the total and average of three scores, the letter grade, and output the results*/
// Importing the Scanner class to receive user input
import java.util.Scanner;
class Main {
public static void main(String[] args) {
//Make an object of the scaner class
Scanner in = new Scanner(System.in);
//Prompt and receive user first and last name;
System.out.println("Please enter your first name");
String First_name = in.next();
System.out.println("Please enter your Last name");
String Last_name = in.next();
//Prompt and receive The three integer scores;
System.out.println("Please enter score for course one");
int courseOneScore = in.nextInt();
System.out.println("Please enter score for course two");
int courseTwoScore = in.nextInt();
System.out.println("Please enter score for course three");
int courseThreeScore = in.nextInt();
//Calculating the total scores and average
int totalScores = courseOneScore+courseTwoScore+courseThreeScore;
double averageScore = totalScores/3;
/*Use if..Else statements to Determine a letter grade based on the following grading scale - 90-100 A; 80-89.99 B; 70-79.99 C; below 70 F */
char letterGrade;
if(averageScore>=90){
letterGrade = 'A';
}
else if(averageScore>=80 && averageScore<=89.99){
letterGrade = 'B';
}
else if(averageScore>=70 && averageScore<=79.99){
letterGrade = 'C';
}
else{
letterGrade ='F';
}
//Printing out the required messages
System.out.printf("Name: %s %s\n", First_name, Last_name);
System.out.printf("scores: %d %d %d: \n", courseOneScore, courseTwoScore, courseThreeScore);
System.out.printf("Total and Average Score is: %d %.2f: \n", totalScores, averageScore);
System.out.printf("Letter Grade: %C: \n", letterGrade);
// System.out.printf("Total: %-10.2f: ", dblTotal);
}
}
Write a function that takes as input two parameters: The first parameter is a positive integer representing a base that is guaranteed to be greater than 1. The second parameter is an integer representing a limit. The function should return a list containing all of the non-negative powers of the base less than the limit (not including the limit). The powers should start at base^0=1 and increase from there until the limit. If the limit is less than 1 the functions should just return an empty list
Answer:
Written in Python:
def powerss(base, limit):
outputlist = []
i = 1
output = base ** i
while limit >= output:
outputlist.append(output)
i = i + 1
output = base ** i
return(outputlist)
Explanation:
This declares the function
def powerss(base, limit):
This creates an empty list for the output list
outputlist = []
This initializes a counter variable i to 1
i = 0
This calculates base^0
output = base ** i
The following iteration checks if limit has not be reached
while limit >= output:
This appends items to the list
outputlist.append(output)
The counter i is increased here
i = i + 1
This calculates elements of the list
output = base ** i
This returns the output list
return(outputlist)
Alice just wrote a new app using Python. She tested her code and noticed some of her lines of code are out of order. Which principal of programing should Alice review?
Answer:
sequencing
Explanation:
from flvs
Answer:
Sequencing
Explanation:
which of the following uses technical and artistic skills to create visual products that communicate information to an audience? ○computer engineer ○typography ○computer animator ○graphic designer
Answer:
grafic desiner
Explanation:
just a guess lol
Answer:
I don't know...
Explanation:
D
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++;
}
}
}
Shortest Remaining Time First is the best preemptive scheduling algorithm that can be implemented in an Operating System.
a. True
b. False
Answer:
a
Explanation:
Yes, true.
Shortest Remaining Time First, also popularly referred to by the acronym SRTF, is a type of scheduling algorithm, used in operating systems. Other times it's not called by its name nor its acronym, it is called the preemptive version of SJF scheduling algorithm. The SJF scheduling algorithm is another type of scheduling algorithm.
The Shortest Remaining Time First has been touted by many to be faster than the SJF
The answer to the question which asks if the Shortest Remaining Time First is the best preemptive scheduling algorithm that can be implemented in an Operating System is:
TrueWhat is Shortest Remaining Time First?This refers to the type of scheduling algorithm which is used to schedule tasks that would be executed in the processing unit in an Operating System based on the shortest time taken to execute the task.
With this in mind, we can see that this is the best preemptive scheduling algorithm that can be implemented in an Operating System because it makes task execution faster.
Read more about scheduling algorithm here:
https://brainly.com/question/15191620
Tasha works as an information technologist for a company that has offices in New York, London, and Paris. She is based out of the New York office and uses the web to contact the London and Paris office. Her boss typically wants her to interact with customers and to run training seminars to teach employees new software and processes. Which career pathway would have this type of employee?
Answer:
D. Interactive Media
Explanation:
i just took the test right now
The career pathway which would have this type of employee is an interactive media.
What is media?Media is a terminology that is used to describe an institution that is established and saddled with the responsibility of serving as a source for credible, factual and reliable news information to its audience within a geographical location, either through an online or print medium.
In this context, an interactive media is a form of media that avail all media personnels an ability to easily and effectively interact with their customers or audience.
Read more on media here: https://brainly.com/question/16606168
List the languages in order from highest level to lowest.
O Python, binary, bytecode
O binary, Python, bytecode
O Python, bytecode, binary
O binary, bytecode, Python
Answer:
Python, bytecode, binary
Explanation:
Python is a high-level multi-purpose programming language. it is very popular and is easy to learn. Its syntax is more English-like compared to other programming languages.
Binary is a form representing data in digital form. It only uses numbers 1 and 0. Binary can be in the form of a machine code or a bytecode.
bytecode is a form of binary for virtual microprocessors which can only be interpreted to machine code for direct processing.
3.4 Code Practice: Question 1
Answer:
color = input("What color? ")
if (color == "yellow"):
print("Correct!")
else:
print("Nope")
Explanation:
My code is dependent on if the color is supposed to be case sensitive
ANSWER ASAP PLSSS
ALSO GIVE ME RIGHT ANSWER NOT A RANDOM ONE
———-——-————————
Question 1 (1 point)
What function would you use to find the total number of views of all the videos?
Average
ОMax
Count
Min
Sum
Answer:
ethier you can do sum and average
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
PV = 11,000 AC = 6000 CV = 4,000. What is SV? What does this calculation tell you?
Answer:
I don't see an SV in the examples.. I suspect these are the name plate numbers off of a transformer... but.. more context would really help
Explanation:
Which of the following tasks can you perform using a word processor?
insert a bulleted list in a document
check a document for spelling errors
edit a video for inclusion in a document
create an outline of sections to be included in a document
set a password to restrict access to a document
The following task can you perform using a word processor is creating an outline of sections to be included in a document. The correct option is c.
What is a word processor?A word processor is a computer program or device that provides for input, editing, formatting, and output of text, often with additional features.
Simply put, the probability is the likelihood that something will occur. When we don't know how an event will turn out, we can discuss the likelihood or likelihood of several outcomes.
Statistics is the study of events that follow a probability distribution. In uniform probability distributions, the chances of each potential result occurring or not occurring are equal.
Therefore, the correct option is c. create an outline of sections to be included in a document.
To learn more about word processors, refer to the link:
https://brainly.com/question/14103516
#SPJ5
Custom function definitions:________.
A. Must be written before they are called by another part of your program
B. Must declare a name for the function
C. Must include information regarding any arguments (if any) that will be passed to the function
D. all of the above
Answer:
D. all of the above
Explanation:
A option is correct and function definition must be written before they are called by another part of your program. But in languages such as C++ you can write the prototype of the function before it is called anywhere in the program and later write the complete function implementation. I will give an example in Python:
def addition(a,b): #this is the definition of function addition
c = a + b
return c
print(addition(1,3)) #this is where the function is called
B option is correct and function definition must declare a name for the function. If you see the above given function, its name is declared as addition
C option is correct and function definition must include information regarding any arguments (if any) that will be passed to the function. In the above given example the arguments are a and b. If we define the above function in C++ it becomes: int addition( int a, int b)
This gives information that the two variables a and b that are parameters of the function addition are of type int so they can hold integer values only.
Hence option D is the correct answer. All of the above options are correct.
Write a program that computes and display the n! for any n in the range1...100
Answer:
const BigNumber = require('bignumber.js');
var f = new BigNumber("1");
for (let i=1; i <= 100; i++) {
f = f.times(i);
console.log(`${i}! = ${f.toFixed()}`);
}
Explanation:
Above is a solution in javascript. You will need a bignumber library to display the numbers in full precision.