The compare_strings function is supposed to compare just the alphanumeric content of two strings, ignoring upper vs lower case and punctuation. But something is not working. Fill in the code to try to find the problems, then fix the problems.

import re
def compare_strings(string1, string2):
#Convert both strings to lowercase
#and remove leading and trailing blanks
string1 = string1.lower().strip()
string2 = string2.lower().strip()

#Ignore punctuation
punctuation = r"[.?!,;:-']"
string1 = re.sub(punctuation, r"", string1)
string2 = re.sub(punctuation, r"", string2)

#DEBUG CODE GOES HERE
print(___)

return string1 == string2

print(compare_strings("Have a Great Day!", "Have a great day?")) # True
print(compare_strings("It's raining again.", "its raining, again")) # True
print(compare_strings("Learn to count: 1, 2, 3.", "Learn to count: one, two, three.")) # False
print(compare_strings("They found some body.", "They found somebody.")) # False

Answers

Answer 1

Answer:

There is a problem in the given code in the following statement:

Problem:

punctuation = r"[.?!,;:-']"

This produces the following error:

Error:

bad character range

Fix:

The hyphen - should be placed at the start or end of punctuation characters. Here the role of hyphen is to determine the range of characters. Another way is to escape the hyphen - using using backslash \ symbol.

So the above statement becomes:

punctuation = r"[-.?!,;:']"  

You can also do this:

punctuation = r"[.?!,;:'-]"  

You can also change this statement as:

punctuation = r"[.?!,;:\-']"

Explanation:

The complete program is as follows. I have added a print statement print('string1:',string1,'\nstring2:',string2) that prints the string1 and string2 followed by return string1 == string2  which either returns true or false. However you can omit this print('string1:',string1,'\nstring2:',string2) statement and the output will just display either true or false

import re  #to use regular expressions

def compare_strings(string1, string2):  #function compare_strings that takes two strings as argument and compares them

   string1 = string1.lower().strip()  # converts the string1 characters to lowercase using lower() method and removes trailing blanks

   string2 = string2.lower().strip()  # converts the string1 characters to lowercase using lower() method and removes trailing blanks

   punctuation = r"[-.?!,;:']"  #regular expression for punctuation characters

   string1 = re.sub(punctuation, r"", string1)  # specifies RE pattern i.e. punctuation in the 1st argument, new string r in 2nd argument, and a string to be handle i.e. string1 in the 3rd argument

   string2 = re.sub(punctuation, r"", string2)  # same as above statement but works on string2 as 3rd argument

   print('string1:',string1,'\nstring2:',string2)  #prints both the strings separated with a new line

   return string1 == string2  # compares strings and returns true if they matched else false

#function calls to test the working of the above function compare_strings

print(compare_strings("Have a Great Day!","Have a great day?")) # True

print(compare_strings("It's raining again.","its raining, again")) # True

print(compare_strings("Learn to count: 1, 2, 3.","Learn to count: one, two, three.")) # False

print(compare_strings("They found some body.","They found somebody.")) # False

The screenshot of the program along with its output is attached.

The Compare_strings Function Is Supposed To Compare Just The Alphanumeric Content Of Two Strings, Ignoring
Answer 2

Following are the modified program to the given question:

Program Explanation:

Import package.Defining a method "compare_strings" that takes two parameters "string1, string2".Inside the method, parameter variables have been used that convert and hold string values into lower case.In the next step, a variable "punctuation" is defined that holds value.After this, a parameter variable is used that calls the sub-method that checks parameter value with punctuation variable value, and at the return keyword is used that check string1 value equal to string2.Outside the method, multiple print method is used calls the method, and prints its value.

Program:

import re #import package

def compare_strings(string1, string2):#defining a method compare_strings that takes two parameters

   string1 = string1.lower().strip()#defining a variable string1 that converts and holds string value into lower case  

   string2 = string2.lower().strip()#defining a variable string1 that converts and holds string value into lower case

   punctuation = r'[^\w\s]'#defining a variable that holds value

   string1 = re.sub(punctuation, '', string1)#using the variable that calls the sub method that checks parameter value with punctuation variable value  

   string2 = re.sub(punctuation, '', string2)#using the variable that calls the sub method that checks parameter value with punctuation variable value  

   return string1 == string2#using return keyword that check string1 value equal to string2

print(compare_strings("Have a Great Day!", "Have a great day?")) # calling method that prints the return value

print(compare_strings("It's raining again.", "its raining, again")) # calling method that prints the return value

print(compare_strings("Learn to count: 1, 2, 3.", "Learn to count: one, two, three.")) # calling method that prints the return value

print(compare_strings("They found some body.", "They found somebody.")) # calling method that prints the return value

Output:

Please find the attached file.

Learn more:

brainly.com/question/21579839

The Compare_strings Function Is Supposed To Compare Just The Alphanumeric Content Of Two Strings, Ignoring

Related Questions

A signal travels from point A to point B. At point A, the signal power is 100 W. At point B, the power is 90 W. What is the attenuation in decibels?

Answers

Answer:

[tex]Attenuation = 0.458\ db[/tex]

Explanation:

Given

Power at point A = 100W

Power at point B = 90W

Required

Determine the attenuation in decibels

Attenuation is calculated using the following formula

[tex]Attenuation = 10Log_{10}\frac{P_s}{P_d}[/tex]

Where [tex]P_s = Power\ Inpu[/tex]t and [tex]P_d = Power\ outpu[/tex]t

[tex]P_s = 100W[/tex]

[tex]P_d = 90W[/tex]

Substitute these values in the given formula

[tex]Attenuation = 10Log_{10}\frac{P_s}{P_d}[/tex]

[tex]Attenuation = 10Log_{10}\frac{100}{90}[/tex]

[tex]Attenuation = 10 * 0.04575749056[/tex]

[tex]Attenuation = 0.4575749056[/tex]

[tex]Attenuation = 0.458\ db[/tex] (Approximated)

Recall that within the ArrayBoundedQueue the front variable and the rear variable hold the indices of the elements array where the current front and rear elements, respectively, of the queue are stored. Which of the following code sequences could be used to correctly enqueue element into the queue, assuming that enqueue is called on a non-full queue and that the code also correctly increments numElements?

a. numElements++; elements[rear) - element:
b. front++; elements(front) - element:
c. rear = (rear + 1) % elements.length; elements[rear) - element;
d. front = (front + 1) % elements.length; elements[front) - element;

Answers

Answer:

c. rear = (rear + 1) % elements.length; elements[rear] = element;

Explanation:

In the above statement:

Name of the array is elements.

rear holds current index of elements array where current rear element of queue is stored. Front are rear are two open ends of the queue and the end from which the element is inserted into the queue is called rear.

element is the element that is required to enqueue into the queue

Enqueue basically mean to add an element to a queue.

Here it is assumed that the queue is not full. This means an element can be added to the queue.

It is also assumed that code also correctly increments numElements.

rear = (rear + 1) % elements.length; This statement adds 1 to the rear and takes the modulus of rear+1 to the length of the array elements[]. This statement specifies the new position of the rear.

Now that the new position of rear is found using the above statement. Next the element can be enqueued to that new rear position using the following statement:

elements[rear] = element; this statement sets the element at the rear-th (new position) index of elements[] array.

For example we have a queue of length 5 and there are already 4 elements inserted into this queue. We have to add a new element i.e. 6 to the queue. There are four elements in elements[] array and length of the array is 5 so this means the queue is not full. Lets say that rear = 3

elements.length = 5

rear = 3

Using above two statements we get.

rear = (rear + 1) % elements.length;

       = 3 + 1 % 5

       = 4%5

      =  4

This computes the new position of rear. So the new position of rear is the 4-th index of elements[]. Now next statement:

elements[rear] = element;

elements[4] = 6

This statement adds element 6 to the 4-th index of elements[] array.

Thus the above statement enqueues element (element 6 in above example) into the queue.

For the Python program below, will there be any output, and will the program terminate?
while True: while 1 > 0: break print("Got it!") break
a. Yes and no
b. No and no
c. Yes and yes
d. No and yes
e. Run-time error

Answers

the answer is e ......
The answer is E ,
hope it’s help

What is the main advantage of using DHCP? A. Allows you to manually set IP addresses B. Allows usage of static IP addresses C. Leases IP addresses, removing the need to manually assign addresses D. Maps IP addresses to human readable URLs

Answers

Answer: DHCP (dynamic host configuration protocol)  is a protocol which automatically processes the configuring devices on IP networks.It allows them to to use network services like: NTP and any communication proto cal based on UDP or TCP. DHCP assigns an IP adress and other network configuration parameters to each device on a network so they can communicate with  other IP networks. it is a part of DDI solution.

 

Explanation:

Multiply each element in origList with the corresponding value in offsetAmount. Print each product followed by a semicolon (no spaces). Ex: If the input is: 4 5 10 12 2 4 7 3 the output is: 8; 20;70; 36; 1 #include 2 3 int main(void) { 4 const int NUM_VALS = 4; 5 int origList[NUM_VALS]; 6 int offsetAmount [NUM_VALS]; 7 int i; 8 9 scanf("%d", &origList[0]); 10 scanf("%d", &origList[1]); 11 scanf("%d", &origList[2]); 12 scanf("%d", &origList[3]); 13 14 scanf("%d", &offsetAmount[0]); 15 scanf("%d", &offsetAmount[1]); 16 scanf("%d", &offsetAmount[2]); 17 scanf("%d", &offsetAmount[3]); 18 19 \* Your code goes here */ 20 21 printf("\n"); 22 23 return 0; 24

Answers

Answer:

Replace /* Your code goes here */  with

for(i =0; i<NUM_VALS; i++) {

    printf("%d", origList[i]*offsetAmount[i]);

printf(";");

}

Explanation:

The first line is an iteration statement iterates from 0 till the last element in origList and offsetAmount

for(i =0; i<NUM_VALS; i++) {

This line calculates and print the product of element in origList and its corresponding element in offsetAmount

    printf("%d", origList[i]*offsetAmount[i]);

This line prints a semicolon after the product has been calculated and printed

printf(";");

Iteration ends here

}

#Write a function called "in_parentheses" that accepts a
#single argument, a string representing a sentence that
#contains some words in parentheses. Your function should
#return the contents of the parentheses.
#
#For example:
#
# in_parentheses("This is a sentence (words!)") -> "words!"
#
#If no text appears in parentheses, return an empty string.
#Note that there are several edge cases introduced by this:
#all of the following function calls would return an empty
#string:
#
# in_parentheses("No parentheses")
# in_parentheses("Open ( only")
# in_parentheses("Closed ) only")
# in_parentheses("Closed ) before ( open")
#
#You may assume, however, that there will not be multiple
#open or closed parentheses.
#Write your function here!
def in_parentheses(a_string):
import re
regex = re.compile(".*?\((.*?)\)")
result = re.findall(regex, a_string)
return(result)
#Below are some lines of code that will test your function.
#You can change the value of the variable(s) to test your
#function with different inputs.
#
#If your function works correctly, this will originally
#print (including the blank lines):
#words!
#
#as he is doing right now
#
#
#!
print(in_parentheses("This is a sentence (words!)."))
print(in_parentheses("No parentheses here!"))
print(in_parentheses("David tends to use parentheses a lot (as he is doing right now). It tends to be quite annoying."))
print(in_parentheses("Open ( only"))
print(in_parentheses("Closed ) only"))
print(in_parentheses("Closed ) before ( open"))
print(in_parentheses("That's a lot of test cases(!)"))

Answers

Answer:

import regex as re

def in_parentheses(a_string):

   regeX = re.compile(".*?\((.*?)\)")

   result = re.findall(regeX, a_string)

   return str(result).replace("[","").replace("]","")

print("test 1: "+in_parentheses("Open ( only"))

print("test 2: "+in_parentheses("This is a sentence (words!)."))

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. Write an if statement that tests the condition ( (A or B ) and C ). Run the program 8 separate times, testing each of the following 8 combinations. Write the results below in the following truth table.
Module 9-Alternative Sequences and Complex logical Criteria v17 (1).pdf. Adobe Acrobat Reader DC
File Edit View Window Help
Home Tools Module 9 - Altema...X
A B C (A or B ) (A or B ) and C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

Answers

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.

Create an application in Java that asks a user for a number of hours, days, weeks, and years. It then computes the equivalent number of minutes (ignoring leap years).

Answers

Answer:

//import the Scanner class

import java.util.Scanner;

//Begin class definition

public class NumberOfMinutes{

    //Begin main method

    public static void main(String []args){

   

       //Create an object of the Scanner class

       Scanner input = new Scanner(System.in);

       

       //initialize a variable nm to hold the number of minutes

       int nm = 0;

       

       //Prompt the use to enter the number of hours

       System.out.println("Please enter the number of hours");

       

       //Receive the input using the Scanner object and

       //Store the entered number of hours in a variable nh

       int nh = input.nextInt();

       

       //Prompt the user to enter the number of days

       System.out.println("Please enter the number of days");

       

       //Receive the input using the Scanner object and

       //Store the entered number of days in a variable nd

       int nd = input.nextInt();

       

       //Prompt the user to enter the number of weeks

       System.out.println("Please enter the number of weeks");

       

       //Receive the input using the Scanner object and

       //Store the entered number of weeks in variable nw

       int nw = input.nextInt();

       

       //Prompt the user to enter the number of years

       System.out.println("Please enter the number of years");

       

       //Receive the input using the Scanner object and

       //Store the entered number of years in a variable ny

       int ny = input.nextInt();

       

       //Convert number of hours to minutes and

       //add the result to the nm variable

       nm += nh * 60;

       

       //Convert number of days to minutes and

       //add the result to the nm variable

       nm += nd * 24 * 60;

       

       //Convert number of weeks to minutes and

       //add the result to the nm variable

       nm += nw * 7 * 24 * 60;

       

       //Convert number of years to minutes and

       //add the result to the nm variable

       nm += ny * 52 * 7 * 24 * 60;

       

       //Display the number of minutes which is stored in nm

       System.out.println("The number of minutes is " + nm);

    }   //End main method

}  //End of class definition

Sample Output:

Please enter the number of hours

>>12

Please enter the number of days

>>2

Please enter the number of weeks

>>4

Please enter the number of years

>>5

The number of minutes is 2664720

Explanation:

The code contains comments explaining every line of the program. Please go through the comments. The actual lines of executable code are written in bold face to distinguish them from comments.

A sample output has also been provided above. Also, a snapshot of the program file, showing the well-formatted code, has been attached to this response.

Can someone help me out with this one? I'm not sure why my code is not working
Now, let's improve our steps() function to take one parameter
that represents the number of 'steps' to print. It should
then return a string that, when printed, shows output like
the following:
print(steps(3))
111
222
333
print(steps(6))
111
222
333
444
555
666
Specifically, it should start with 1, and show three of each
number from 1 to the inputted value, each on a separate
line. The first line should have no tabs in front, but each
subsequent line should have one more tab than the line
before it. You may assume that we will not call steps() with
a value greater than 9.
Hint: You'll want to use a loop, and you'll want to create
the string you're building before the loop starts, then add
to it with every iteration.
Write your function here
def steps(number):
i = 1
while i < number + 1:
string = str(i) * 3
string1 = str(string)
if i != 0:
string1 = (i * 4*' ' + "\b" + "\b" + "\b" + "\b") + string
elif i == 1:
string1 = string
print(string1)
i = i + 1
#The following two lines will test your code, but are not
#required for grading, so feel free to modify them.
print(steps(3))
print(steps(6)

Answers

Answer:

Add this statement at the end of your steps() function

return ""

This statement will not print None at the end of steps.

Explanation:

Here is the complete function with return statement added at the end:

def steps(number):  # function steps that takes number (number of steps to print) as parameter and prints the steps specified by number

   i = 1  #assigns 1 to i

   while i < number + 1:  

       string = str(i) * 3  #multiplies value of i by 3 after converting i to string

       string1 = str(string)  # stores the step pattern to string1

       if i != 0:  # if the value of i is not equal to 0

           string1 = (i * 4*' ' + "\b" + "\b" + "\b" + "\b") + string  #set the spaces between steps

       elif i == 1:  # if value of i is equal to 1

           string1 = string  #set the string to string1

       print(string1)  # print string1

       i = i + 1  # increments i at each iteration

   return "" #this will not print None at the end of the steps and just add a an empty line instead of None.

Screenshot of the corrected program along with its output is attached.

____ enable users to create and edit collaborative Web pages quickly and easily; they are intended to be modified by others and are especially appropriate for collaboration.

Answers

Answer:

Wikis

Explanation:

Wikis can be defined as a database that was designed by users which gives users the opportunity to add, edit and delete collaborative web pages easily.

It lets users to manage contents easily and they are used to create static websites.

some wikis can be accessed by the public. A great example is Wikipedia.

Wikis allows publishing and sharing of documents to be done easily.

Discuss the differences between dimensionality reduction based on aggregation and dimensionality reduction based on techniques such as PCA and SVD.

Answers

Answer:

Following are the difference to this question can be defined as follows:

Explanation:

In terms of projections of information into a reduced dimension group, we can consider the dimension structure of PCA and SVD technologies.  In cases of a change in the length, based on consolidation, there's also a unit with dimensions. When we consider that the days have been aggregated by days or the trade of a commodity can be aggregated to both the area of the dimension, accumulation can be seen with a variance of dimension.

Dimensionality reduction based on aggregation involves selection of important character and variable from a large variable and dimensionality reduction based on techniques with the use of PCA and SVD.

What is dimensionality?

Dimensionality involves reducing features that have been written or identified or constructing less features from a pool of important features.

Principal components analysis(PCA) and Single value decomposition(SVD) is a form or analysis that can be used to reduce some character that are not important to an information and can also help to select important variables from among many variables.

Therefore, dimensionality reduction based on aggregation involves selection of important character and variable from a large variable and dimensionality reduction based on techniques with PCA and SVD.

Learn more on dimensional analysis here,

https://brainly.com/question/24514347

Assemble a Server computer based on your budget (state the amount in Ghana Cedis), discussing the type of components (giving their exact names, model numbers, types, cost, architecture, etc.) you would need and give reasons why you need them. ​

Answers

Answer:

Following are the answer to this question:

Explanation:

The server would be generally a powerful processor instead of a desktop pc. It must choose the Dell server browser to choose a server for industrial applications.

Dell Poweredge R730 has been its pattern.  There should be the reason whether these servers are efficient, available, flexible, and support the concept of even a virtual environment.  Its same servers are easy to use, as well as the memory will be connected to this server is 8 TB.

What are some of the common security weaknesses inherent in Unix or Linux based systems and what techniques can be used to harden these systems against an attack?

Answers

Answer:

The answer is below

Explanation:

1.  Lack of password enforcement

2.  Outdated third party applications: this includes outdated software such as Apache, PHP, MySQL, OpenSSL, and VNC

3.  General lack of patch management for the OS

4.  General lack of system hardening:

5.  Lack of backups

Ways to hardened the Linux/Unix based computer system is do the following:

1.  Perform minimal Installation: this involves, installing softwares that are necessary, and limiting the number of admin users on the computer system.

2.  Carry out Code Auditing: this is a means of preventing security issues, by withing more secure softwares to prevent variable declarations, or otherwise unexpected logic.

3.  Ensure there is a Traffic filter firewall: this will helps to attacks from external users or hackers. Install, Web Applicatio firewall, which helps to filter out traffic.

4.  Carry out Softwares updates: a software update can help prevent or guide against security leaks in a software

5.  Install security updates only: this is done by filtering out the security-related programs and only upgrade packages which are referred to in the custom file.

Write a function wordcount() that takes the name of a text file as input and prints the number of occurrences of every word in the file. You function should be case-insensitive so 'Hello' and 'hello' are treated as the same word. You should ignore words of length 2 or less. Also, be sure to remove punctuation and digits.
>>>wordcount('frankenstein.txt')
artifice 1
resting 2
compact 1
service 3

Answers

Answer:

I am writing a Python program. Let me know if you want the program in some other programming language.        

import string  #to use string related functions

def wordcount(filename):  # function that takes a text file name as parameter and returns the number of occurrences of every word in file

   file = open(filename, "r")  # open the file in read mode

   wc = dict()  # creates a dictionary

   for sentence in file:  # loop through each line of the file

       sentence = sentence.strip()  #returns the text, removing empty spaces

       sentence=sentence.lower() #converts each line to lowercase to avoid case sensitivity

       sentence = sentence.translate(sentence.maketrans("", "", string.punctuation))  #removes punctuation from every line of the text file

       words = sentence.split(" ")  # split the lines into a list of words

       for word in words:  #loops through each word of the file

           if len(word)>2:  #checks if the length of the word is greater than 2

               if word in wc:  # if the word is already in dictionary

                   wc[word] = wc[word] + 1  #if the word is already present in dict wc then add 1 to the count of that word

               else:  #if the word is not already present

                   wc[word] = 1  # word is added to the wc dict and assign 1 to the count of that word                

   for w in list(wc.keys()):  #prints the list of words and their number of occurrences

       print(w, wc[w])  #prints word: occurrences in key:value format of dict        

wordcount("file.txt") #calls wordcount method and passes name of the file to that method

Explanation:

The program has a function wordcount that takes the name of a text file (filename) as parameter.

open() method is used to open the file in read mode. "r" represents the mode and it means read mode. Then a dictionary is created and named as wc. The first for loop, iterates through each line (sentence) of the text file. strip() method is used to remove extra empty spaces or new line character from each sentence of the file, then each sentence is converted to lower case using lower() method to avoid case sensitivity. Now the words "hello" and "Hello" are treated as the same word.

sentence = sentence.translate(sentence.maketrans("", "", string.punctuation))  statement uses two methods i.e. maketrans() and translate(). maketrans() specifies the punctuation characters that are to be deleted from the sentences and returns a translation table. translate() method uses the table that maketrans() returns in order to replace a character to its mapped character and returns the lines of text file after performing these translations.

Next the split() method is used to break these sentences into a list of words. Second for loop iterates through each word of the text file. As its given to ignore words of length 2 or less, so an IF statement is used to check if the length of word is greater than 2. If this statement evaluates to true then next statement: if word in wc:   is executed which checks if the word is already present in dictionary. If this statement evaluates to true then 1 is added to the count of that word. If the word is not already present  then the word is added to the wc dictionary and 1 s assigned to the count of that word.

Next the words along with their occurrences is printed. The program and its output are attached as screenshot. Since the frankenstein.txt' is not provided so I am using my own text file.

Write a program to help a travelling sales person keep up with their daily mileage driven for business. In your main method, the program should first ask the user how many days of mileage they want to enter and then collect the user input for each day's miles, storing the values entered in an appropriately sized array.

Answers

Answer:

The programming language is not stated;

The program written in C++ is as follows (See Explanation Section for detailed explanation);

#include<iostream>

using namespace std;

int main()

{

 int numdays;

 cout<<"Number of days of mileage: ";

 cin>>numdays;

 int miles[numdays];

for(int i=0;i<numdays;i++)

{

 cout<<"Miles traveled on day "<<i+1<<": ";

 cin>>miles[i];

}

 int total = 0;

 for(int i=0;i<numdays;i++)

{

 total+=miles[i];

}

cout<<"Total mileage traveled: "<<total;

 return 0;

}

Explanation:

This line declares the number of days of mileage

 int numdays;

This line prompts user for days of mileage

 cout<<"Number of days of mileage: ";

This line accepts input from the traveler for days of mileage

 cin>>numdays;

This line creates an array

 int miles[numdays];

The italicized is an iteration that collects the user input for each day

for(int i=0;i<numdays;i++)

{

 cout<<"Miles traveled on day "<<i+1<<": ";

 cin>>miles[i];

}

This line initializes variable to 0

 int total = 0;

The italicized is an iteration that adds up the mileage traveled by the traveler each day  

 for(int i=0;i<numdays;i++)

{

 total+=miles[i];

}

This line prints the total miles traveled

cout<<"Total mileage traveled: "<<total;

If each sandbox has size 16 megabytes, how many applets can be sandboxed on a machine with a 32-bit address space

Answers

Given that,

Size of each sandbox = 16 MB

Address space = 32- bit

We need to calculate the total size of address space

Using formula of total size

[tex]\text{total size of address space}=2^{32}[/tex]

[tex]\text{total size of address space}=4\times10^9[/tex]

[tex]\text{total size of address space}=4\ Gigabytes[/tex]

We need to calculate the total of applets

Using formula of total applets

[tex]\text{total applets}=\dfrac{\text{total size of address space}}{\text{size of one applet}}[/tex]

Put the value into the formula

[tex]\text{total applets}=\dfrac{4\ GB}{16\ MB}[/tex]

[tex]\text{total applets}=\dfrac{4\times1024\ MB}{16\ MB}[/tex]

[tex]\text{total applets}=256[/tex]

Hence,  The total of applets are 256.

If distances are recorded as 4-bit numbers in a 500-router network, and distance vectors are exchanged 3 times/second, how much total bandwidth (in bps) is used by the distributed routing algorithm

Answers

Answer:

A total of 6,000 bps of bandwidth is used by the distributed routing algorithm

Explanation:

This is a bandwidth requirement question.

We proceed as follows;

To calculate the total number of bits for a routing table, we use the following formula;

Routing table=Number of routers * length of cost

we are given the following parameters from the question;

Number of routers = 500

length of cost = 4 bits

Routing table = 500*4

=2000

Hence, a routing table is 2000 bits in length.

Now we proceed to calculate the bandwidth required on each line using the formula below;

Bandwidth = no.of seconds * no.of bits in routing table

Bandwidth required on each line = 3*2000

=6000

The statistical report is typically used to set targets for the organization's expenditures for the year and then report actual costs on a monthly or quarterly basis.
A. True
B. False

Answers

Answer:

False

Explanation:

Budget and Financial reports are used to set targets for organization's expenditure. These reports display cost and expenditures related to all assets, raw material, inventory of the organization. The variance is then calculated based on targeted figures and the actual expenses. The deviation from target is found by the variance and then actions are taken for it. Managers rely heavily on these reports. Statistical reports are non financial reports. These focus on customer satisfaction, employee performance, staff turnover rate and assets performance.

Which functions are examples of logical test arguments used in formulas? Check all that apply. OR IF SUM COUNT NOT AND

Answers

Answer: Which functions are examples of logical test arguments used in formulas? Check all that apply.

Explanation: A.or B.if E.not F. And

This is correct just took it :)

Among the following functions, those that are  the logical test arguments used in formulas are OR, IF, NOT and, AND.

What are logical test argument functions ?

To compare several conditions or numerous sets of conditions, logical functions are utilized. By weighing the arguments, it determines if the answer is TRUE or FALSE.

These operations are used to determine the outcome and aid in choosing one of the available data. The contents of the cell are assessed using the appropriate logical condition depending on the necessity. The types of logical functions used in this tutorial include: OR, AND, IF, NOT and XOR.

These all functions are used in different conditions. Therefore, for the given options the logical testing arguments are OR, IF, NOT and, AND. They are very common functions in Excel sheet.

Find more on logical functions :

https://brainly.com/question/27053886

#SPJ3

NMCI is the name used for a large-scale effort to link Navy and Marine Corps computer systems on bases, boats, and in offices around the world. When completed, this internal WAN will use Internet technology to link soldiers in the field with support personnel on bases, etc. NMCI is an example of a(n):

Answers

Answer:

The answer is "Intranet".

Explanation:

The intranet becomes an information exchange computer network, in which the resources collaborate with OS and other computing infrastructure within the organization. It is usually done without access from third parties and primarily uses for analysis of the data.

Here, the NMCI links the computer network of navy and maritime bodies on the bases of both the boats and the regional offices, that's why we can say that it is the example of the Internet.

coefficient of x in expansion (x+3)(x-1)

Answers

Answer:

[tex]\boxed{2}[/tex]

Explanation:

[tex](x+3)(x-1)[/tex]

Expand the brackets.

[tex]x(x-1)+3(x-1)[/tex]

[tex]x^2-x+3x-3[/tex]

Combine like terms.

[tex]x^2+2x-3[/tex]

The coefficient of [tex]x[/tex] is [tex]2[/tex].

Which can be used to code a simple web page? CSS JavaScript Text editor Web browser

Answers

Answer:

option (C) Text editor is the correct answer in this question.

Explanation:Used to code a web page, an editor is required that  is a basic requirement.The other options are secondary ,text editors are provided with operating system and software development .Text editor specialized html editors can offer convenience and added functionality.Test editors require of html and any other web technology like Java script,and server-side scripting languages.

Answer:

It is text editor!

Explanation:

"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings. For each match, add one point to user_score. Upon a mismatch, end the game. Ex: The following patterns yield a user_score of 4: simonPattern: R, R, G, B, R, Y, Y, B, G, Y userPattern: R, R, G, B, B, R, Y, B, G, Y

Answers

Answer:

user_score = 0  #user score is initialized to 0

simonPattern = 'RRGBRYYBGY'# stores the sequence of characters in simonPattern

userPattern  = input("Enter user pattern: ")  # prompts the user to enter user pattern and stores the pattern in userPattern

for x in range(len(simonPattern)):  #loops through entire length of simonPattern using x as index variable

   if userPattern[x] == simonPattern[x]:  # checks if the element at x-th index of userPattern matches the element at x-th index of simonPattern

       user_score = user_score + 1  # adds 1 to user score if above if condition evaluates to true

   else:  #if a mismatch occurs  

       break  #loop break if mismatch occurs

print("User Score:",user_score) #prints the computed user score

Explanation:

The program first declares a simonPattern string variable and assign it a sequence of characters. You can also prompt to enter the Simon pattern as

simonPattern = input("Enter Simon pattern:")

If you want to hard code the values of both simonPattern and userPattern then change the first two statements after user_score =0 statement as:

simonPattern = 'RRGBRYYBGY'

userPattern  = 'RRGBBRYBGY'

Now I will explain the working of the for loop.

for x in range(len(simonPattern)):

len method is used which returns the length of the string stored in simonPattern. For example if simonPattern = 'RRGBRYYBGY' then len returns 10

range method is used to generate a sequence of numbers for x. This means value of x starts from 0 and it  keeps incrementing to 1 until the length of the simonPattern is reached.

At first iteration:

Let suppose user enters the pattern: RRGBBRYBGY

x starts at index 0. Value of x=0 is less than the length of simonPattern i.e. 10 so the body of loop executes. The body of loop contains the following if statement:

if userPattern[x] == simonPattern[x]:

It matches both the string for the value of x.

if userPattern[0] == simonPattern[0]:

First character (at 0th index) of userPattern is R and in simonPattern is also R so this statement executes:  user_score = user_score + 1  which adds 1 to the user_score. So user_score=1

Next iteration:

x=1

if userPattern[1] == simonPattern[1]:

Second character (at 1st index) of userPattern is R and in simonPattern is also R so this statement executes:  user_score = user_score + 1  which adds 1 to the user_score. So user_score=2

Next iteration:

x=2

if userPattern[2] == simonPattern[2]:

Third character (at 12nd index) of userPattern is G and in simonPattern is also G so this statement executes:  user_score = user_score + 1  which adds 1 to the user_score. So user_score=3

Next iteration:

x=3

if userPattern[3] == simonPattern[3]:

Fourth character (at 3rd index) of userPattern is B and in simonPattern is also B so this statement executes:  user_score = user_score + 1  which adds 1 to the user_score. So user_score=4

Next iteration:

x=4

if userPattern[4] == simonPattern[4]:

Fifth character (at 4th index) of userPattern is B and in simonPattern is R so the if part does not execute and program moves to the else part which has a break statement which means the loop break. The next print(user_score) statement print the value of user_score. As user_score=4 computed in above iterations so output is:

User Score: 4

Answer:

The other answer was so close, but the _ was left out so the answer was wrong.

Written in Python:

user_score = 0

simon_pattern = input()

user_pattern  = input()

for x in range(len(simon_pattern)):

   if user_pattern[x] == simon_pattern[x]:

       user_score = user_score + 1

   else:

       break

print('User score:', user_score)

Explanation:

7.8 LAB: Palindrome A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never odd or even" (ignoring spaces). Write a program whose input is a word or phrase, and that outputs whether the input is a palindrome.

Answers

Answer:

word = input("Write a word: ").strip().lower()

without_space = word.replace(" ","")

condition = without_space == without_space[::-1]

print("Is %s palindrome?: %s"%(word,condition))

Suppose that an engineer excitedly runs up to you and claims that they've implemented an algorithm that can sort n elements (e.g., numbers) in fewer than n steps. Give some thought as to why that's simply not possible and politely explain

Answers

Answer:

The summary including its given problem is outlined in the following section on the interpretation.

Explanation:

That's not entirely feasible, since at least n similarities have to be made to order n quantities. Find the finest representation where the numbers of 1 to 10 have already been arranged.

⇒ 1 2 3 4 5 6 7 8 9 10

Let's say that we identify one figure as the key then compared it towards the numbers across the left. Whether the correct number is greater, therefore, left number, are doing nothing to switch the location elsewhere.

Because although the numbers have already been categorized 2 has always been compared to 1 which would be perfect, 3 becomes especially in comparison to 2 and so much more. This should essentially take 9 moves, or nearly O(n) moves.

If we switch that little bit already

⇒ 1 3 2 4 5 6 7 8 9 10

3 Is contrasted with 1. 2 will indeed be matched against 3 as well as 2. Since 2 has indeed been exchanged, it must, therefore, be matched with 1 as there might be a case whereby each number z exchanged is greater than the number Y as well as the quantity X < Y.

X = 1, Y = 3, and Z = 2.

Only one adjustment expanded the steps which culminated in n+1.

It should be noted that it won't be possible because at least n similarities have to be made to order n quantities.

From the information given, it should be noted that it's not possible for the engineer to implement an algorithm that can sort n elements (e.g., numbers) in fewer than n steps.

This is because there are at least n similarities have to be made to order n quantities. In this case, the numbers of 1 to 10 have already been arranged. When a number is greater, it should be noted that the left number will do nothing to switch the location elsewhere.

Therefore, the information given by the engineer isn't feasible.

Learn more about algorithms on:

https://brainly.com/question/24953880

7. When using find command in word we can search?
a. Characters
b. Formats
c. Symbols
d. All of the above

Answers

Answer:

When using find command in word we can search all of the above

Without data compression, and focusing only on the data itself without any overhead, what transmission rate is required to send 30 frames per second of gray-scale images with resolution 1280 x 1024?

Answers

Answer:

315 Mbps

Explanation:

Given data :

30 frames per second

resolution = 1280 * 1024

what transmission rate is required can be calculated as

frames per second = rendered frames / number of seconds passed

30 = 30 / 1

Transmission rate = the rate at which the images are transmitted from source to destination =315 Mbps without data compression

a software development management tool that easily integrates into his business’s enterprise software/information system

Answers

Answer:

Enterprise software/system

Explanation:

Enterprise software which is also known as Enterprise Application Software (EAS) is computer software that its primary function is to meet the needs of an organization rather than that of an individual.

EAS or Enterprise System is the software development management tool that easily integrates into a business' enterprise software system.

What are the links between the operating systems, the software, and hardware components in the network, firewall, and IDS that make up the network defense implementation of the banks' networks.

Answers

Answer:

In several organizations, the operating system (OS) functions at the core of the personal computers in use and the servers. The OS ought to be secure from external threats to its stored data and other resources.

Explanation:

In this regard, Intrusion detection systems play a critical role in protecting the sensitive data, along with software firewalls. Hardware firewalls protect the hardware elements in the network (such as storage drivers etc), the IDS and as well as the IPS.

#Write a function called after_second that accepts two #arguments: a target string to search, and string to search #for. The function should return everything in the first #string *after* the *second* occurrence of the search term. #You can assume there will always be at least two #occurrences of the search term in the first string. # #For example: # after_second("11223344554321", "3") -> 44554321 # #The search term "3" appears at indices 4 and 5. So, this #returns everything from the index 6 to the end. # # after_second("heyyoheyhi!", "hey") -> hi! # #The search term "hey" appears at indices 0 and 5. The #search term itself is three characters. So, this returns #everything from the index 8 to the end. # #Hint: This may be more complicated than it looks! You'll #have to look at the length of the search string and #either modify the target string or take advantage of the #extra arguments you can pass to find(). #Write your function here!

Answers

Answer:

Following are the code to this question:

def after_second(s,sub):#defining a method a fter_second

   first = s.find(sub)#defining a variable first that hold method find value

   if first != -1:#defining if block to check first variable value not equal to -1 using slicing  

       s = s[len(sub)+first:]#defining s variable to calculate sub parameter length of parameter and use slicing

       second = s.find(sub)#defining second variable to calculate find method value  

   if second != -1:#defining if block to calculate second variable slicing

       return s[len(sub)+second:]#return s variable value

print(after_second("heyyoheyhi","hey"))#defining print method to call after_second method

print(after_second("11223344554321","3"))#defining print method to call after_second method

Output:

hi

44554321

Explanation:

In the above python code a method "after_second" is declared, that accepts two-variable "s, and sub" as the parameter inside the method a first variable is declared that uses the inbuilt method "find" to find the value and stores it value. In the next step, two if blocks are used, in which both if blocks use the slicing to checks its value is not equal to "-1".

In the first, if block the first variable is declared that uses the s variable to calculate subparameter length by using slicing and defines the second variable that finds its value and stores its value. In the next, if block the s variable is used to return its calculated value, and at the end of the print, the method is used to call the method by passing parameter value and prints its return value.
Other Questions
Larry's Lunchcart is a small street vendor business. If Larry makes 15 pretzels in his first hour of business and incurs a total cost of $16.50, his average total cost per pretzel is a. $1.10. b. $6.50. c. $15.00. d. $16.50. Polysaccharides are polymers of monosaccharides. Homopolysaccarides are made up of only one type of monomer, whereas heteropolysaccharides are composed of at least two different kinds of monomers.Are starch, glycogen, cellulose, and chitin classified as homopolymers or heteropolymers? A. All four polysaccharides are homopolymers. B. All four polysaccharides are heteropolymers. C. Starch is a heteropolymer, whereas chitin, cellulose, and glycogen are homopolymers. D. Chitin is a heteropolymer, whereas starch, cellulose, and glycogen are homopolymers. The owners decide to take the company public through an IPO, issuing additional 1 million new shares. Assuming that they successfully complete the IPO, the net income for the next year is estimated to be $6 million. The price of shares is set using average price-earnings ratios for similar businesses of 15. What portion of the company will be owned by the angel investor after the IPO How did the events of the war change Hitlers strategy? Because the thirteen American colonies were part of the British Empire, Draw the structure of 1,4-hexanediamine.Draw the molecule on the canvas by choosing buttons from the Tools (for bonds), Atoms, and Advanced TemplateTowbars. The single bond is active by default. Include all hydrogen atoms.View Available Hint(s) Darwin Inc. sells a particular textbook for $20. Variable expenses are $14 per book. At the current volume of 50,000 books sold per year the company is just breaking even. Given these data, the annual fixed expenses associated with the textbook total: ALGEBRA HELP PLEASE THANKS Evaluate the expression using exponential rules. Write the result in standard notation. [tex]\frac{4 x 10^{-4} }{20 x 10^{2} }[/tex] Why can the use of fertilizers, pesticides, and industrial chemicals unintentionallyharm a community's water supply? Panamint Systems Corporation is estimating activity costs associated with producing disk drives, tapes drives, and wire drives. The indirect labor can be traced to four separate activity pools. The budgeted activity cost and activity base data by product are provided below. Activity Cost Activity Base Procurement $308,500 Number of purchase orders Scheduling $244,500 Number of production orders Materials handling $419,700 Number of moves Product development $720,200 Number of engineering changes Production $1,538,300 Machine hours Number of Purchase Orders Number of Production Orders Number of Moves Number of Engineering Changes Machine Hours Number of Units Disk drives 4,080 450 1,320 11 2,400 1,600 Tape drives 2,300 155 520 4 8,200 4,400 Wire drives 11,300 740 4,300 23 10,600 2,500 Determine the activity rate per production order for scheduling. a.$72.56 b.$17.45 c.$229.37 d.$181.78 In "The Leap," what does the narrator suggest is the main reason that her mother, now blind from cataracts, can still safely negotiate her New Hampshire home? Find the smallest number whichwhen multiplied with 28800 willthe product a perfect cubefurthur, find thefind the cube root ofthe product. Help please!Thank you Perteet Corporation's relevant range of activity is 3,000 units to 7,000 units. When it produces and sells 5,000 units, its average costs per unit are as follows: Average Cost per Unit Direct materials$6.70 Direct labor$3.25 Variable manufacturing overhead$1.60 Fixed manufacturing overhead$3.00 Fixed selling expense$0.70 Fixed administrative expense$0.40 Sales commissions$0.50 Variable administrative expense$0.55 If 4,000 units are produced, the total amount of manufacturing overhead cost is closest to A vacation resort rents SCUBA equipment to certified divers. The resort charges an up-front fee of $25 and another fee of $12.50 an hour. How much is it if you rent the SCUBA equipment for 45 minutes Which may result from an increase in friction?A: decreased tractionB: increased speedC: reduced wear and tearD: generation of heat Which method would be the BEST to protect security information and event management (SIEM) log data at rest from tampering by authorized users?A. Access control lists (ACLs) on log data drivesB. Deployment of write once read many (WORM) drivesC. Disk encryption using hardware security modules (HSM) on log data drivesD. Implementing the principle of least privilege on log data drives The price level increases. The short-run aggregate supply curve will Choose one: A. shift to the right. B. shift to the left. C. remain unchanged. Which factor is a negative influence on health? A. Restaurant inspections B. Nutrition guidelines C. Disease Transmission D. City Politics debit Product Warranty Expense; credit Cash b. debit Product Warranty Expense; credit Product Warranty Payable c. debit Product Warranty Payable; credit Cash d. debit Product Warranty Payable; credit Product Warranty Expense