Assign max_sum with the greater of num_a and num_b, PLUS the greater of num_y and num_z. Use just one statement. Hint: Call find_max() twice in an expression.
Sample output with inputs: 5.0 10.0 3.0 7.0
max_sum is: 17.0
1 det find_max(num_1, num_2):
2 max_val = 0.0
3
4 if (num_1 > num_2): # if num1 is greater than num2,
5 max_val = num_1 # then num1 is the maxVal.
6 else: # Otherwise,
7 max_val = num_2 # num2 is the maxVal
8 return max_val
9
10 max_sum = 0.0
11
12 num_a = float(input)
13 num_b = float(input)
14 num_y = float(input)
15 num_z = float(input)
16
17"" Your solution goes here
18
19 print('max_sum is:', max_sum)

Answers

Answer 1

Answer:

def find_max(num_1, num_2):

   max_val = 0.0

   if (num_1 > num_2): # if num1 is greater than num2,

       max_val = num_1 # then num1 is the maxVal.

   else: # Otherwise,

       max_val = num_2 # num2 is the maxVal

   return max_val

max_sum = 0.0

num_a = float(input())

num_b = float(input())

num_y = float(input())

num_z = float(input())

max_sum = find_max(num_a, num_b) + find_max(num_y, num_z)

print('max_sum is:', max_sum)

Explanation:

I added the missing part. Also, you forgot the put parentheses. I highlighted all.

To find the max_sum, you need to call the find_max twice and sum the result of these. In the first call, use the parameters num_a and num_b (This will give you greater among them). In the second call, use the parameters num_y and num_z (This will again give you greater among them)


Related Questions

In the Stop-and-Wait flow-control protocol, what best describes the sender’s (S) and receiver’s (R) respective window sizes?

Answers

Answer:

The answer is "For the stop and wait the value of S and R is equal to 1".

Explanation:

As we know that, the SR protocol is also known as the automatic repeat request (ARQ), this process allows the sender to sends a series of frames with window size, without waiting for the particular ACK of the recipient including with Go-Back-N ARQ.  This process is  mainly used in the data link layer, which uses the sliding window method for the reliable provisioning of data frames, that's why for the SR protocol the value of S =R and S> 1.

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

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

"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:

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)

The most widely used presentation software program is Microsoft PowerPoint. You can produce a professional and memorable presentation using this program if you plan ahead and follow important design guidelines. What text and background should you use in a darkened room

Answers

Answer:

Light text on a dark background

Explanation:

Microsoft PowerPoint is an application software in which the company ables to introduce themselves by making slides and presented to an audience in an easy and innovative way. In this,  we can add pictures, sound, video by adding the different text, colors, backgrounds, etc

For memorable and professional presentations, the light text on a dark background is a best combination as it is easy to read and give the best view of the message you want to convey.

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

}

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

A number, a, is a power of b if it is divisible by b and a/b is a power of b. Write a function called is_power that takes parameters a and b and returns True if a is a power of b.

Answers

Answer:

Here is the Python program.

def is_power(a, b): # function that takes two positive integers a and b as arguments

  if a == b: #first base case: if both the numbers are equal

      return True #returns True if a=b

  elif b==1: #second base case: if the value of b is equal to 1

      return False #returns False if b==1

  else: #recursive step

      return a%b==0 and is_power(a/b, b) #call divisible method and is_power method recursively to determine if the number is the power of another          

Explanation:

return a%b==0 and is_power(a/b, b) statement basically means a number, a, is a power of b if it is divisible by b and a/b is a power of b

In the statement return a%b==0 and is_power(a/b, b) , a%b==0 checks whether a number a is completely divisible by number b. The % modulo operator is used to find the remainder of the division. If the remainder of the division is 0 it means that the number a is completely divisible by b otherwise it is not completely divisible.

The second part of the above statement calls is_power() method recursively. The and operator between the two means that both of the parts of the statement should be true in order to return true.

is_power() method takes two numbers a and b as arguments. First the method checks for two base cases. The first base case: a == b. Suppose the value of a = 1 and b =1 Then a is a  power of b if both of them are equal. So this returns True if both a and b are equal.

Now the program checks its second base case b == 1. Lets say a is 10 and b is 1 Then the function returns False because there is no positive integer that is the power of 1 except 1 itself.

Now the recursive case return return a%b==0 and is_power(a/b, b) takes the modulo of a and b, and is_power method is called recursively in this statement. For example if a is 27 and b is 3 then this statement:

a%b==0 is True because 27 is completely divisible by 3 i.e. 27 % 3 = 0

is_power(a/b,b) is called. This method will be called recursively until the base condition is reached. You can see it has two arguments a/b and b. a/b = 27/3 = 9 So this becomes is_power(9,3)

The base cases are checked. Now this else statement is again executed  return a%b==0 and is_power(a/b, b) as none of the above base cases is evaluated to true. when a%b==0 is True as 9 is completely divisible by 3 i.e. 9%3 =0 and is_power returns (9/3,3) which is (3,3). So this becomes is_power(3,3)

Now as value of a becomes 3 and value of b becomes 3. So the first base case a == b: condition now evaluates to true as 3=3. So it returns True.

Now in order to check the working of this function you can call this method as:                                                                                        

print(is_power(27, 3))

The output is:

True

K-Map is a method used for : 1 Solving number system 2 To apply De-morgan’s Law 3 To simplify Logic Diagram 4 Above all

Answers

Answer:

The answer is to simplify the logic diagrams.

Explanation:

With the help of K-map, we can find the Boolean expression with the minimum number of the variables. To solve the K-map, there is no need of theorems of the Boolean algebra. There are 2 forms of the K-map - POS (Product of Sum) and SOP (Sum of Product), these forms are used according to the requirement. From these forms, the expression can be found.

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.

____ 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.

#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.

You want to change your cell phone plan and call the company to discuss options. This is a typical example of CRM that focuses on_______loyalty programs for current customerscustomer service and supportprofitability for the companyacquisition of new customers.

Answers

Answer:

customer service and support

Explanation:

-Loyalty programs for current customers refer to incentives companies provide to existing customers to encourage them to keep buying their products or services.

-Customer service and support refers to the assistance companies provide to their existing customers to help them solve issues or provide information about their current products or services and other options.

-Profitability for the company refers to actions that will increase the financial gains of the company.

-Acquisition of new customers refers to actions implemented to attract clients.

According to this, the answer is that this is a typical example of CRM that focuses on customer service and support because you call the company to get assistance with options to change your current products.

The other options are not right because the situation is not about incentives for the customer or actions the company implements to increase its revenue. Also, you are not a new customer.

Assume a PHP document named hello.php has been saved in a folder named carla inside the htdocs folder on your computer. Which is the correct path to enter to view this page in a browser?

Answers

The available options are:

A. localhost/Carla/hello.php

B. localhost/htdocs/hello.php

C. localhost/htdocs/Carla/hello.php

D. carla/hello.php5

Answer:

C.  localhost/htdocs/Carla/hello.php  

Explanation:

A path in computer programming can be defined as the name of a file or directory, which specifies a unique location in a file system.

Therefore, to get the correct path to enter to view this page in a browser, one needs to follow the directory tree hierarchy, which is expressed in a string of characters in which path components, separated by a delimiting character, represent each directory.

Hence, correct path to enter to view this page in a browser is "localhost/htdocs/Carla/hello.php"

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

The variable sentence stores a string. Write code to determine how many words in sentence start and end with the same letter, including one-letter words. Store the result in the variable same_letter_count.

Answers

Answer:

sentence = "hello wow a stores good"

same_letter_count = 0

sentence_list = sentence.split()

for s in sentence_list:

   if s[0] == s[-1]:

       same_letter_count += 1

print(same_letter_count)

Explanation:

*The code is in Python.

Initialize the sentence with a string

Initialize the same_letter_count as 0

Split the sentence using split method and set it to the sentence_list

Create a for loop that iterates through the sentence_list. If the first and last of the letters of a string are same, increment the same_letter_count by 1

When the loop is done, print the same_letter_count

When you use Word's Email option to share a document, you should edit the _____ line to let the recipient know the email is from a legitimate source.

Answers

Answer:

Subject line

Explanation:

Editing the subject line is very important so as to enable the recipient know the source of received the message (document).

For example, if a remote team working on a project called Project X receives a shared document by one member of team, we would expect the subject line of the email to be– Project X document. By so doing the legitimacy of the email is easily verified.

vSphere Client is used to install and operate the guest OS. true or false

Answers

Answer:

True

Explanation:

A guest Operating System (OS) is a secondary OS to the main installed OS which is the host Operating System (OS). Guest OS can either be a part of a partition or a Virtual Machine (VM). This guest OS is used as a substitute to the host OS.

vSphere Web Client can be installed by using a CD-ROM, DVD or ISO image which has the installation image to make a Virtual Machine (VM) functional.

#Write a function called "replace_all" that accepts three #arguments: # # - target_string, a string in which to search. # - find_string, a string to search for. # - replace_string, a string to use to replace every instance # of the value of find. # #The arguments will be provided in this order. Your function #should mimic the behavior of "replace", but you cannot use #that function in your implementation. Instead, you should #find the result using a combination of split() and join(), #or some other method. # #Hint: This exercise can be complicated, but it can also #be done in a single short line of code! Think carefully about #the methods we've covered. #Write your function here!

Answers

Answer:

Here is the function replace_all:

def replace_all(target_string,find_string,replace_string):

   result_string = replace_string.join(target_string.split(find_string))  

   return result_string

#if you want to see the working of this function then you can call this function using the following statements:

target_string = "In case I don't see ya, good afternoon, good evening, and good night!"

find_string = "good"

replace_string = "bad"

print(replace_all(target_string, find_string, replace_string)

Explanation:

The above program has a function called replace_all that accepts three arguments i.e target_string, a string in which to search ,find_string, a string to search for and replace_string, a string to use to replace every instance of the value of find_string. The function has the following statement:

replace_string.join(target_string.split(find_string))  

split() method in the above statement is splits or breaks the target_string in to a list of strings based on find_string. Here find_string is passed to split() method as a parameter which works as a separator. For example above:

target_string = In case I don't see ya, good afternoon, good evening, and good night!

find_string = good

After using target_string.split(find_string) we get:

["In case I don't see ya, ", ' afternoon, ', ' evening, and ', ' night']

Next join() method is used to return a string concatenated with the elements of target_string.split(find_string). Here join takes the list ["In case I don't see ya, ", ' afternoon, ', ' evening, and ', ' night'] as parameter and joins elements of this list by 'bad'.

replace_string = bad

After using replace_string.join(target_string.split(find_string))  we get:

In case I don't see ya, bad afternoon, bad evening, and bad night!  

The program and output is attached as a screenshot.

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.

Class or Variable "____________" serve as a model for a family of classes or variables in functions` definitions

Answers

Answer:

Parameter.

Explanation:

A parameter variable stores information which is passed from the location of the method call directly to the method that is called by the program.

Class or Variable parameter serve as a model for a family of classes or variables in functions' definitions.

For instance, they can serve as a model for a function; when used as an input, such as for passing a value to a function and when used as an output, such as for retrieving a value from the same function.

Hence, when you create classes or variables in a function, you can can set the values for their parameters.

For instance, to pass a class to a family of classes use the code;

\\parameter Name as Type (Keywords) = value;

\\procedure XorSwap (var a,b :integer) = "myvalue";

Write a program that takes as command-line arguments an integer N and a double value p (between 0 and 1), plots N equally spaced dots of size .05 on the circumference of a circle, and then, with probability p for each pair of points, draws a gray line connecting them.

Answers

Answer:

Please see below

Explanation:

Suppose N = 10. And you have these dots equidistant from each other, and probability = 0.3. According to the data provided in the question statement, we will then have forty-five pairs of points. The task is to draw lines amongst these pairs, all 45 of them, with a 30% probability. Keep in mind that every one of the 45 lines are independent.

A few lines of simple code (just some for loops) needed to run this is attached in the image herewith, .

 

#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!)."))

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.

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.

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.

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))

"The ______ code of a rootkit gets the rootkit installation started and can be activated by clicking on a link to a malicious Web site in an email or opening an infected PDF file."

Answers

Answer:

Dropper.

Explanation:

A rootkit can be defined as a collection of hidden malicious computer software applications that gives a hacker, attacker or threat actor unauthorized access to parts of a computer and installed software. Some examples of rootkits are trojan, virus, worm etc.

The dropper code of a rootkit gets the rootkit installation started and can be activated by clicking on a link to a malicious website in an email or opening an infected PDF file such as phishing.

Hence, the dropper code of a rootkit launches and installs the loader program and eventually deletes itself, so it becomes hidden and not be noticed by the owner of the computer.

A rootkit can affect the performance of a computer negatively causing it to run slowly.

Other Questions
A 78-year-old grandmother presents for evaluation of weakness in her face. She has a long-standing history of hypertension that has been under fair control. On physical examination you note that she has ptosis and miosis of the left eye and left facial anhidrosis. What is your most likely diagnosis What impact did the Renaissance have on European society?It increased the power of the Catholic Church.It enabled Italy to conquer most of the continent.It led people to question traditional religious teachings.It inspired political leaders to share power with common people. Which method of persuasive writing does the following sentence use: This is the right thing to do? ethical appeals emotional appeals rhetorical questions facts g If attempting to dissolve both silver bromide and silver chloride in aqueous solution through complex ion formation, which data will be the most relevant? La casa de Marta y Ramn es muy grande. ________ casa es bonita tambin. fill in the blank QUICKEST ANSWER GETS BRAINIEST List two events and give examples from your life, explaining how each event shaped you. what is the 6th term in the geometric sequence described by this explicit formula ? If there are 736 students in a school, prove that at least three students have a birthday on the same day of the year. The height of a cone is two times its base diameter. What is the volume of the cone in terms of its base radius r?A.IRV =23V=4B.Oc. v=1V = 1/2v=1D.3. Global warming is associated which of the followingIn a biology class, your friend had to read Jared Diamonds essay The Worst Mistake in the History of the Human Race, which details the drawbacks of sedentary life and agriculture. Your friend wants to know why humans continued to farm in the face of disease and other issues. What would be a valid response? Group of answer choices? Fine the value of x in the triangle. Then classify the triangle as acute, right,or obtuse.47* 45* x Could an able-bodied person receiving all or most of their income from government transfer payments achieve earned success? Why or why not? the battle of antietam affected the focus of the civil war by The majority of Americans hold service occupations jobs.Please select the best answer from the choices providedTF What type of reaction is: ammonium nitrate -> dinitrogen monoxide + water? why is religious rivalry important to the war of spain and england ? URGENT According to Karl Marx, what group would eventually "rise up" in a socialist revolution Explain how the distributive property helps us multiply the following polynomials and why and how the final products differ: (a + b)^2, (a b)^2, and (a - b)(a + b). A man walking on a railroad bridge is 2/5 of the way along the bridge when he notices a train at a distance approaching at the constant rate of 45 mph . The man can run at a constant rate in either direction to get off the bridge just in time before the train hits him. How fast can the man run? and click SubmitBy visual inspection, determine the best fitting regression model for thescatterplot.O A QuadraticO B. LinearOC ExponentialOD. No pattern