Answer:
import java.util.Scanner; //to accept input from user
import java.util.Random; //to generate random numbers
public class Main { //class name
public static void main(String[] args) { //main method
System.out.println("Please select one of [R/P/S]: "); //prompts user to select a choice
Scanner scanner = new Scanner(System.in); //reads input choice
String playerChoice = scanner.next().toUpperCase().replace(" ", ""); //converts the choice to upper case and stores it in playerChoice
if (playerChoice.equals("R") || playerChoice.equals("P") || playerChoice.equals("S")) { // if player choice is a valid choice
results(CompChoice(), playerChoice); // calls method to compute result of game
} else { //if player enters invalid choice
System.out.println("\nInvalid choice!"); } } //error message
private static String CompChoice() { //to generate computer choice
Random generator = new Random(); //to generate random numbers
int comp = generator.nextInt(3)+1; //generates 3 random numbers
String compChoice = ""; //to store computer choice
switch (comp) { //checks the random number for corresponding computer choice
case 1: //1 is for Rock
compChoice = "Rock"; //sets compChoice to Rock
break;
case 2: //random number 2 is for Paper
compChoice = "Paper"; //sets compChoice to Paper
break;
case 3: //random number 3 is for Scissors
compChoice = "Scissors"; //sets compChoice to Scissors
break; }
return compChoice; } //returns computer choice
private static void results(String compChoice, String playerChoice) { //method to compute result
if(playerChoice.equals("R")) //if playerChoice is equal to R
{ playerChoice = "Rock"; //stores Rock to playerChoice
System.out.println("You chose: Rock");} //displays player choice
else if(playerChoice.equals("P")) //if playerChoice is equal to P
{ playerChoice = "Paper"; //stores Paper to playerChoice
System.out.println("You chose: Paper");} //displays player choice
else //if playerChoice is equal to S
{ playerChoice="Scissors"; //stores Scissors to playerChoice
System.out.println("You chose: Scissors"); } //displays player choice
System.out.println("I chose: " + compChoice); //displays computer choice
if (compChoice.equals(playerChoice)) { //if compChoice is equal to playerChoice
System.out.println("a tie!"); //its a tie if computer and player choice is the same
System.exit(1); }//exits on tie
boolean youWin = false; //variable to check if player wins
if (compChoice.equals("Rock")) { //if computer choice is Rock
if (playerChoice.equals("Paper")) //if player choice is Paper
{System.out.println("Paper beats Rock.");
youWin = true;} //player wins to youWin is set to true
else if(playerChoice.equals("Scissors")) { //if player choice is Scissors
System.out.println("Rock beats scissors.");
youWin = false;} } //player loses to youWin is set to false
if (compChoice.equals("Paper")) { //if computer choice is Paper
if (playerChoice.equals("Rock")) //if player choice is Rock
{System.out.println("Paper beats Rock.");
youWin = false;} //player loses to youWin is set to false
else if(playerChoice.equals("Scissors")) { //if player choice is Scissors
System.out.println("Scissors beats Paper.");
youWin = true;} } //player wins to youWin is set to true
if (compChoice.equals("Scissors")) { //if computer choice is Scissors
if (playerChoice.equals("Rock")) //if player choice is Rock
{System.out.println("Rock beats Scissors.");
youWin = true;} //player wins to youWin is set to true
else if(playerChoice.equals("Paper")) { //if player choice is Paper
System.out.println("Scissors beats Paper.");
youWin = false;} } //player loses to youWin is set to false
if (youWin) //if player wins means if youWin is true
System.out.println("you win!"); //declare player to be winner
else //if player loses means if youWin is false
System.out.println("you lose!"); } } //declare player to lose
Explanation:
The program is well explained in the comments attache with each line of program. The program has three methods. One is the main method to start the game and prompts user to enter a choice and converts the user input choice to upper case. One is CompChoice method that generates three random numbers and uses switch statement to set 1 for Rock, 2 for Paper and 3 for Scissors . One method is results that takes computer choice and player choice as parameters to decide the winner. It uses if else statements to check if choice of user wins from choice of computer or vice versa. It uses a boolean variable youWin which is set to true when player choice beats computer choice otherwise is set to false. At the end if youWin is true then the player is declared winner otherwise not. The screenshot of the program output is attached.
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;
}
}
Write two statements to read in values for my_city followed by my_state. Do not provide a prompt. Assign log_entry with current_time, my_city, and my_state. Values should be separated by a space. Sample output for given program if my_city is Houston and my_state is Texas: 2014-07-26 02:12:18: Houston Texas Note: Do not write a prompt for the input values. 1 current_time = '2014-07-26 02:12:18:' 2 my_city = "' 3 my_state = "" 4 log_entry - "' 1 test passed 6 print(log_entry) All tests passed Run Run
Answer:
Here is the program:
current_time = '2014-07-26 02:12:18:'
my_city = ''
my_state = ''
log_entry = ''
my_city = input("") #reads in value for my_city
my_state = input("") #reads in value for my_state
log_entry = current_time + ' ' + my_city + ' ' + my_state #concatenates current_time, my_city and my_state values with ' ' empty space between them
print(log_entry)
Explanation:
You can also replace
log_entry = current_time + ' ' + my_city + ' ' + my_state
with
log_entry = f'{current_time} {my_city} {my_state}'
it uses f-strings to format the strings
If you want to hard code the values for my_city and my_state then you can replace the above
my_city = input("")
my_state = input("")
with
my_city = "Houston"
my_state = "Texas"
but if you want to read these values at the console from user then use the input() method.
The screenshot of the program along with the output is attached.
In this exercise we have to use the knowledge of the python language to write the code, so we have to:
The code is in the attached photo.
So to make it easier the code can be found at:
current_time = '2014-07-26 02:12:18:'
my_city = ''
my_state = ''
log_entry = ''
my_city = input("") #reads in value for my_city
my_state = input("") #reads in value for my_state
log_entry = current_time + ' ' + my_city + ' ' + my_state #concatenates current_time, my_city and my_state values with ' ' empty space between themlog_entry = current_time + ' ' + my_city + ' ' + my_state
log_entry = f'{current_time} {my_city} {my_state}'
my_city = input("")
my_state = input("")
my_city = "Houston"
my_state = "Texas"
See more about python at brainly.com/question/26104476
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.
How is actual cost calculated?
Please answer
Answer:
One method of calculating product costs for a business is called the actual costs/actual output method. Using this technique, you take your actual costs — which may have been higher or lower than the budgeted costs for the year — and divide by the actual output for the year.
Explanation:
To prevent any unnecessary injuries to small adults and the elderly from a deploying airbag, these
individuals should
as possible.
A. position their seats as far forward
B. position their seats as far back
c. recline their seats as far back
D. none of the above
Answer:
B. position their seats as far back
Explanation:
An airbag can be defined as a vehicle safety device (bag) that is designed to be inflated and eventually deflated in an extremely rapid or quick manner during an accident or collision.
Basically, an airbag refers to an occupant-restraint safety device installed on vehicles to protect both the driver and front-seat passenger in the event of an accident or collision. An airbag typically comprises of an impact sensor, flexible fabric bag, airbag cushion and an inflation module.
In order to prevent any unnecessary injuries to small adults and the elderly from a deploying airbag, these individuals should position their seats as far back as possible. This ultimately implies that, both the driver and the front-seat passenger are advised not to position too close to the dashboard; the seats should be as far back as possible.
(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
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 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
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
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.
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
Choose the word to make the sentence true. The ____ function is used to display the program's output.
O input
O output
O display
The output function is used to display the program's output.
Explanation:
As far as I know this must be the answer. As tge output devices such as Monitor and Speaker displays the output processed.
The display function is used to display the program's output. The correct option is C.
What is display function?Display Function Usage displays a list of function identifiers. It can also be used to display detailed usage information about a specific function, such as a list of user profiles with the function's specific usage information.
The displayed values include the prefix, measuring unit, and required decimal places.
Push buttons can be used to select functions such as summation, minimum and maximum value output, and tare. A variety of user inputs are available.
A display is a device that displays visual information. The primary goal of any display technology is to make information sharing easier. The display function is used to display the output of the program.
Thus, the correct option is C.
For more details regarding display function, visit:
https://brainly.com/question/29216888
#SPJ5
This assignment requires you to write a program to analyze a web page HTML file. Your program will read one character at a time from the file specifying the web page, count various attributes in the code for the page, and print a report to the console window giving information about the coding of the page.
Note that a search engine like Google uses at least one technique along similar lines. To calculate how popular (frequently visited or cited) a web page is, one technique is to look at as many other worldwide web pages as possible which are relevant, and count how many links the world's web pages contain back to the target page.
Learning Objectives
To utilize looping structures for the first time in a C++ program
To develop more sophisticated control structures using a combination of selection and looping
To read data from an input file
To gain more experience using manipulators to format output in C++
To consider examples of very simple hypertext markup language (HTML)
Use UNIX commands to obtain the text data files and be able to read from them
Problem Statement
Your program will analyze a few things about the way in which a web page is encoded. The program will ask the user for the name of a file containing a web page description. This input file must be stored in the correct folder with your program files, as discussed in class, and it must be encoded using hypertext markup language, or HTML. The analysis requires that you find the values of the following items for the page:
number of lines (every line ends with the EOLN marker; there will be an EOLN in front of the EOF)
number of tags (includes links and comments)
number of links
number of comments in the file
number of characters in the file (note that blanks and EOLNs do count)
number of characters inside tags
percentage of characters which occur inside tags, out of the total
Here is an example of a very simple HTML file:
Course Web Page
This course is about programming in C++.
Click here
You may assume that the HTML files you must analyze use a very limited subset of basic HTML, which includes only the following "special" items:
tag always starts with '<' and ends with >
link always starts with "
comment always starts with ""
You may assume that a less-than symbol (<) ALWAYS indicates the start of a tag. A tag in HTML denotes an item that is not displayed on the web page, and often gives instructions to the web browser. For example, indicates that the next item is the overall title of the document, and indicates the end of that section. In tags, both upper and lowercase letters can be used.
Note on links and comments: to identify a link, you may just look for an 'a' or 'A' which occurs just after a '<'. To identify a comment, you may just look for a '!' which follows just after a '' (that is, you do not have to check for the two hyphens).
You may assume that these are the only HTML language elements you need to recognize, and that the HTML files you process contain absolutely no HTML syntax errors.
Note: it is both good style because readability is increased, and convenient, to declare named constants for characters that are meaningful, for example
const char TAG OPEN = '
Sample Input Files
Program input is to be read from a text file. Your program must ask the user for interactive input of the file name. You can declare a variable to store the file name and read the user's response
Miscellaneous Tips and Information
You should not read the file more than once to perform the analysis. Reading the file more than once is very inefficient.
The simplest, most reliable and consistent way to check for an end of file condition on a loop is by checking for the fail state, as shown in lectures. The eof function is not as reliable or consistent and is simply deemed "flaky" by many programmers as it can behave inconsistently for different input files and on different platforms.
You may use only while loops on this project if you wish; you are not required to choose amongst while, do while and/or for loops until project 4 and all projects thereafter. Do not create any functions other than main() for this program. Do not use data structures such as arrays. You may only have ONE return statement and NO exit statements in your code. You may only use break statements inside a switch statement in the manner demonstrated in class; do not use break or continue statements inside loops.
#include // used for interactive console I/O
#include // used to format output
#include // used to retrieve data from file
#include // used to convert data to uppercase to simplify comparisons
#include 11 for string class functions
int main() { 1
//constants for analysing HTML attributes
const char EOLN = '\n';
const char COMMENT_MARK = '!';
const char LINK='A';
//constants to format the output
const int PAGEWIDTH = 70;
const char UNDERLINE = '=';
const char SPACE =
const int PCT_WIDTH = 5;
const int PCT_PRECISION = 2;
Answer:
bro it is a question what is this
Explanation:
please follow me
Plz help ASAP
Where are fiber optic cables often used?
A. To connect LANs inside your home
B. To support wireless access points (WAP)
C. To enable near field communications
D. To connect networks that are far apart of that have high data volumes.
Answer:
D
Explanation:
fiber optic cables are generally used by isps which is why they call their internet fiber optic
Documents files should be saved as a _____ file
Answer:
Explanation:
Consider the two lists A and B. List A is an anagram of list B if the following two conditions are true: 1.list A and list B have the same number of elements 2.each element of list A occurs the same number of times in list A and list BFor example, [3, 2, 4, 1, 2] and [2, 2, 3, 1, 4] are anagram of each other, but [2, 3, 1, 2] and [1, 3, 1, 2] are not. Write a function named isAnagram that takes two lists of integers as parameters: lstA and lstB. The function isAnagram should return the bool value True if lstA is an anagram of lstB and False otherwise. The following is an example of correct output: >>> print(isAnagram([14, 10, 19], [10, 14, 19]))True
Answer:
cdacaddacdbbbbbacddebb
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
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
After a chart has been inserted and formatted, is it possible to change the data range it refers to or to add new rows of data?
A:No, additional data cannot be included in a chart once it has been created; the user should delete the chart and create a new chart.
B:Yes, click the Select Data button in the Data group under the Design tab to extend or reduce the data range.
C:Yes, click the chart, select the additional rows or columns of data to add, and press Enter on the keyboard.
D:Yes, double-click the chart and select Properties from the list; in the Properties box, insert the new data range to include in the chart.
Answer:
b) Yes, click on the Select Data button in the Data group under the Design tab to extend or reduce the data range.
Explanation:
The correct answer is b. Data ranges included in a chart frequently need to change to include more rows or columns. Extend or reduce the range quickly by using the Select Data Source dialogue box to revise the data range. :)
Answer:
ITS B
Explanation:
edge2021
Question 8 (3 points) Which of the following is an external factor that affects the price of a product? Choose the answer.
sales salaries
marketing strategy
competition
production cost
Answer: tax
Explanation: could effect the cost of items because the tax makes the price higher
oh sorry i did not see the whole question
this is the wrong awnser
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.
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 error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d. human e. None of the above
Answer:
Logic Error
Explanation:
I'll answer the question with the following code segment.
Program to print the smallest of two integers (written in Python)
num1 = int(input("Num 1: "))
num2 = int(input("Num 2: "))
if num1 < num2:
print(num2)
else:
print(num1)
The above program contains logic error and instead will display the largest of the two integers
The correct logic is
if num1 < num2:
print(num1)
else:
print(num2)
However, the program will run successfully without errors
Such errors are called logic errors
Which transition level is designed to begin the process of public participation?
A. Level 1: Monitor
B. Level 2: Command
C. Level 3: Coordinate
D. Level 4: Cooperate
E. Level 5: Collaborate
How could these same commands be used on a computer or network operating system?
Answer:
To manipulate data into information
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.
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 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
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:
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