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. Test your implementation on file great_expectations.txt¶

Answers

Answer 1

Answer:

I am writing a Python program:

import string  # here is this is used in removing punctuation from file

def wordcount(filename):  #definition of wordcount method that takes file name as argument

   file  = open(filename, "r")  #open method opens the file whose name is specified and r is for read mode. Object "file" is used to open a file in read mode

   count = dict()  #creates a dictionary

   for strings in file:  # iterates through every line of the text file

       strings = strings.strip()  #strip() method removes the white spaces from every line of the text file

       strings = strings.lower()  #converts all the characters of the text file to lower case to make function case insensitive

       strings = strings.translate(strings.maketrans("", "", string.punctuation))  # deletes punctuation each line of the text file

       words = strings.split(" ")  #split the lines of file to a list of words

       for word in words:  #iterates through each words of the list of words

           if len(word)>2:  #ignores words of length 2 or less

               if word in count:  #if word is present in dictionary count already

                   count[word] = count[word] + 1  #then add 1 to the existing word count

               else:  #if the word is not present already in the dictionary

                   count[word] = 1  # set the count of the word that is not already present to 1 in order to add that word to dictionary

   for key in list(count.keys()):  # iterates through each key (words) in the list of words and print the contents of dict counts i.e. words along with their no. of occurrences

       print(key, ":", count[key])  # print the words and their occurences in word:occurence format for example hello:1 means hello exists once in text file

       file.close()  #closes the file

#two statements first ask the user to enter the name of the file and then call the function wordcount() by passing the name of that file in order to print the number of occurrences of every word in the file.

name = input('Enter a filename: ')

wordcount(name)

Explanation:

The program is well explained in the comments above. The program has a function wordcount() that takes a text file name as its parameter. First it opens that file in read mode. Then the first for loop moves through each line of the text file and removes the white spaces from every line of the text file using split() method, converts all the characters of the text file to lower case to make function case insensitive using lower() method, deletes punctuation each line of the text file  using maketras() method and translate methods. maketrans() method specify the list of punctuation that need to be  remove from the each line of the file. This method then returns this list in the form of a table which is passed to translate() method. Then translate() method uses this table to modify lines in order to remove the punctuation from lines. Next the lines are split into list of words using split() method. Then the second for loop moves through each word and counts the number of occurrences of each word in the text file. len(word)>2: len function returns the length of the word and if the length of the word is less than 2 than that word is ignored. count is set to 1, every time a new word is added to dictionary and if the word is already present in the dictionary then the count of word is incremented by 1. At the end the contents of dictionary are displayed in key: count[key] format in which key is each word and value is the number of occurrences of that word. Since the great_explectations.txt file is not attached so i have used my own file. You can use this code for you file.

Write A Function Wordcount() That Takes The Name Of A Text File As Input And Prints The Number Of Occurrences
Write A Function Wordcount() That Takes The Name Of A Text File As Input And Prints The Number Of Occurrences

Related Questions

Which guideline should an employee use when taking notes for a report

Answers

They should respect what is going on and wittiest down everything they can and get it to be the truth or closet to the truth. Also if they say sow,thing happened and they don't want you to right it would be for the best not to right it

1. He is sincere while making report bcz when he make report by heart it is definitely useful.

He is always remain alert bcz any mistake can influence his ratings or project importance

Create a program that will find and display the largest of a list of positive numbers entered by the user. The user should indicate that he/she has finished entering numbers by entering a 0.

Answers

Answer:

This program is written using Python Programming language,

The program doesn't make use of comments (See explanation section for line by line explanation)

Program starts here

print("Enter elements into the list. Enter 0 to stop")

newlist = []

b = float(input("User Input: "))

while not b==0:

    newlist.append(b)

    b = float(input("User Input: "))

newlist.sort()

print("Largest element is:", newlist[-1])

Explanation:

This line gives the user instruction on how to populate the list and how to stop

print("Enter elements into the list. Enter 0 to stop")

This line creates an empty list

newlist = []

This line enables the user to input numbers; float datatype was used to accommodate decimal numbers

b = float(input("User Input: "))

The italicized gets input from the user until s/he enters 0

while not b==0:

    newlist.append(b)

    b = int(input("User Input: "))

This line sorts the list in ascending order

newlist.sort()

The last element of the sorted list which is the largest element is printed using the next line

print("Largest element is:", newlist[-1])

Complete the method, print Multiples(), that takes in a positive integer n, and another positive integer, max. Print out all the multiples of n that are less than or equal to max. Print each multiple on a separate line. For example, if the method is called with n

Answers

Answer:

public static void printMultiples(int n, int max){

    for (int i=1; i<=max; i++){

        if(i%n == 0)

            System.out.println(i);

    }

}

Explanation:

Create a method called printMultiples that takes two parameters n and max

Inside the method, create a for loop that iterates from 1 to max. If i, a number between 1 and max, % n is equal to 0, that means the number is a multiple of n, print the number.

Write a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of words separated by commas. Your program should output the words and their frequencies (the number of times each word appears in the file) without any duplicates.

Answers

Answer:

Here is the Python code.

import csv  

inputfile = input("Enter name of the file: ")

count = {}

with open(inputfile, 'r') as csvfile:

 csvfile = csv.reader(csvfile)

 for line in csvfile:

   for words in line:

     if words not in count.keys():

       count[words] = 1

     else:

         count[words] + 1

   print(count)

Explanation:

I will explain the code line by line.

import csv   here the css is imported in order to read the file using csv.reader() method

inputfile = input("Enter name of the file: ")  This statement takes the name of the input file from the user

count = {}  this is basically a dictionary which will store the words in the file and the number of times each word appears in the file.

with open(inputfile, 'r') as csvfile:  This statement opens the inputfile using open() method in read mode. This basically opens the input file as csv type

 csvfile = csv.reader(csvfile)  This statement uses csv.reader() method to read the csv file contents.

for line in csvfile:  This outer for loop iterates through each line of the file

for words in line:  This inner loop iterates through each word in the line

if words not in count.keys():  This if condition checks if the word is not in the dictionary already. The dictionary holds key value pair and keys() method returns a list of all the keys of dictionary

count[words] = 1  if the word is not present already then assign 1 to the count dictionary

co unt[words] + 1 if the word is already present in dictionary increment count of the words by 1. Suppose the input file contains the following words:

hello,cat,man,hey,dog,boy,Hello,man,cat,woman,dog,Cat,hey,boy

Then because of co unt[words] + 1 statement if the word appears more than once in the file, then it will not be counted. So the output will be:

{' cat': 1, ' man': 1, ' dog': 1, ' woman': 1, ' Hello': 1, ' hey': 1, ' boy': 1, 'hello': 1, ' Cat': 1}

But if you want the program to count those words also in the file that appear more than once, then change this co unt[words] + 1 statement to:  

count[words] = count[words] + 1

So if the word is already present in the file its frequency is increased by 1 by incrementing 1 to the count[words]. This will produce the following output:

{' Cat': 1, ' cat': 2, ' boy': 2, ' woman': 1, ' dog': 2, ' hey': 2, ' man': 2, ' Hello': 1, 'hello': 1}  

You can see that cat, boy, dog and hey appear twice in the file.                    

print(count) This statement prints the dictionary contents with words and their frequencies.

The program with its output is attached.

The program is an illustration of file manipulations.

File manipulations involve reading from and writing into files.

The program in Python, where comments are used to explain each line is as follows:

#This imports csv module

import csv  

#This initializes a dictionary

kounter = {}

#This gets input for the file name

fname = input("Filename: ")

#This opens and iterates through the file

with open(fname, 'r') as cfile:

   #This reads the csv file

   cfile = csv.reader(cfile)

   #This iterates through each line

   for line in cfile:

       #This iterates through each word on each line

       for words in line:

           #This counts the occurrence of each word

           if words not in kounter.keys():

               kounter[words] = 1

           else:

               kounter[words] + 1

#This prints the occurrence of each word

print(kounter)

Read more about similar programs at:

https://brainly.com/question/14468239

Consider the following algorithm. x â 1 for i is in {1, 2, 3, 4} do for j is in {1, 2, 3} do x â x + x for k is in {1, 2, 3, 4, 5} do x â x + 1 x â x + 5 Count the number of + operations done by this algorithm.

Answers

Answer:

Number of + operation done by this algorithm is 60

Explanation:

i = 4

j = 3

k = 6

Now, let "n" be number of '+' operations

n = i × j + i × 2k

substituting the figures

n = 4 × 3 + 4 × (2 × 6)

n = 12 + 4 × 12

n = 12 + 48

n = 60

Answer:

i can't see some of the numbers

Explanation:

Suppose that a main method encounters the statement t3.join(); Suppose that thread t3's run() method has completed running. What happens?
A. The main method waits for all running threads to complete their run() methods before proceeding.
B. The main method waits for any other thread to complete its run() method before proceeding
C. The main method proceeds to the next statement following the t3.join(); statement
D. Thread t 3 is re-started
E. All threads except t3 that are running are terminated

Answers

Answer:

C. The main method proceeds to the next statement following the t3.join(); statement

Explanation:

join() method allows the thread to wait for another thread and completes its execution. If the thread object is executing, then t3.join() will make that t is terminated before the program executes the instruction. Thread provides the method which allows one thread to another complete its execution. If t is a thread object then t.join() will make that t is terminated before the next instruction. There are three overloaded functions.

join()

join(long mills)

join(long millis, int Nanos)

If multiple threads call the join() methods, then overloading allows the programmer to specify the period. Join is dependent on the OS and will wait .

A network security analyst received an alert about a potential malware threat on a user’s computer. What can the analyst review to get detailed information about this compromise? Check all that apply

Answers

Complete Question:

A network security analyst received an alert about a potential malware threat on a user’s computer. What can the analyst review to get detailed information about this compromise? Check all that apply.

A. Logs.

B. Full Disk Encryption (FDE).

C. Binary whitelisting software.

D. Security Information and Event Management (SIEM) system.

Answer:

A. Logs.

D. Security Information and Event Management (SIEM) system.

Explanation:

If a network security analyst received an alert about a potential malware threat on a user’s computer. In order to get a detailed information about this compromise, the analyst should review both the logs and Security Information and Event Management (SIEM) system.

In Computer science, logs can be defined as records of events triggered by a user, operating system and other software applications running on a computer. Log files are used to gather information stored on a computer such as user activities, system performance and software program.

Security Information and Event Management (SIEM) system is the process of gathering and integration of all the logs generated by a computer from various software application, service, process, or security tool.

These logs collected through the SIEM are shown in a format that is readable by the security analyst and this help in real-time detection of threats.

Hence, logs and SIEM systems are important tools for network security analyst for detection of threats in real-time and event management functions.

var name = prompt("Enter the name to print on your tee-shirt");
while (name.length > 12) {
name = prompt("Too long. Enter a name with fewer than 12 characters.");
}
alert("The name to be printed is " + name.toUpperCase());

What will happen if the user enters Willy Shakespeare at the first prompt?

a. The user will be prompted to enter a different name
b. The alert will display The name to be printed is " + name.toUpperCase()
c. The alert will display The name to be printed is WILLY SHAKESPEARE
d. The alert will display The name to be printed is WILLY SHAKES

Answers

Willy Shakespeare has 17 characters. It's higher than 12,so the output will be Too long. Enter a name with fewer than 12 characters.

Letter a.

All the protocol layers of the internet (Application, Transport. Network) were originally without any security. TLS is one of the security architectures added later. In the Internet protocol stack. TLS is located:________. 1. right above the application layer 2. right below the application layer 3. right below the transport layer 4. right above the IP layer

Answers

Answer:

2. right below the application layer

Explanation:

TLS (Transport Layer Security) is an improved and more secured version of the SSL (Secure Socket Layer) used as cryptographic protocol for providing authentication and encryption over a network. It is initialized at the transport layer of the IP stack and finalized at the application layer. In other words, it is located between the transport and application layer of the Internet protocol stack. And this is necessary so that data received in the application layer from the transport layer are protected from start to end between these two layers.

Therefore, it is safe to say that the TLS is located right below the application layer.  



11. Which one of the following buttons is used for paragraph alignment?

Answers

Answer:

C

Explanation:

Option A is used for line spacing.

Option B is used for right indent.

Option C is used for right paragraph alignment.

Option D is used for bullet points.

The button used for paragraph alignment would be option C.

If your computer freezes on a regular basis and you checked your hard drive and you have insufficient space you've not installed any software that could cause disruption you have recently added more around so you realize that you have enough memory and that isn't causing a problem what could you do to check next? A) Ensure that the computer is disconnected from the internet by removing any Ethernet cables. B) Use scandisk to ensure that the hard drive is not developing errors or bad sectors. C) Replace the CPU and RAM right away. D) Install additional fans to cool the motherboard.

Answers

Answer:

d

Explanation:

If your computer freezes on a regular basis, and you have enough memory and that isn't causing a problem. You should install additional fans to cool the motherboard. The correct option is D.

What is computer freezing?

Computer freezing means the computer is not running smoothly. It is causing concerns in opening any application or running software. It is also called computer hanging. The freezing can occur due to the heating of the motherboard. The addition of the fans would be good.

Freezing on the computer happens when the memories of the computer are full, or any virus has been installed on the computer. Hanging or freezing of computers can be avoided by emptying some data or installing an antivirus.

Thus, the correct option is D. Install additional fans to cool the motherboard.

To learn more about computer freezing, refer to the link:

https://brainly.com/question/15085423

#SPJ2

Your on-premises hosted application uses Oracle database server. Your database administrator must have access to the database server for managing the application. Your database server is sized for seasonal peak workloads, which results in high licensing costs. You want to move your application to Oracle Cloud Infrastructure (OCI) to take advantage of CPU scaling options. Which database offering on OCI would you select?

Answers

Answer:

Bare metal DB systems

Explanation:

Oracle Call Interface OCI is comprehensive system which is native C language interface to Oracle Database for custom applications. The bare metal database system requires more compute node processing power. Customers are not given OS logons or SYSDBA in Oracle autonomous applications which prevents phishing attacks.

In cell B13, create a formula using the VLOOKUP function that looks up the value from cell A11 in the range A5:B7, returns the value in column 2, and specifies an exact match.

Answers

Answer:

VLOOKUP(A11,A5:B7,2,0)  is the correct answer to this question.

Explanation:

The VLOOKUP method contains a vertical lookup by scouring for worth in a table's first section and trying to return the significance in the throughout the situation within the same row. The VLOOKUP excel is a built-in function classified as a Lookup / see as.

According to the question:-

The formulation needed to enter is = VLOOKUP(A11, A5: B7,2,0)

The first "A11" here is the cell from which value is retrieved

The second "A5: B7" input is the range for the table where you need to lookup. 2 Is the number of the column from which the value is taken and 0 indicates the exact math

The VLOOKUP function is used to look up a value in a particular column.

The VLOOKUP formula to enter in cell B13 is: VLOOKUP(A11,A5:B7,2,0)

The syntax of a VLOOKUP function is:

VLOOKUP(lookup_value, cell_range, column_index, [return_value])

Where:

lookup_value represents the value to look upcell_range represents the cells to checkcolumn_index represents the column index[return_value] is an optional entry, and it represents the value that will be returned by the look up function.

From the question, we have:

lookup_value = cell A11cell_range = cell A5 to B7column_index = 2[return_value] = 0

So, the VLOOKUP function would be: VLOOKUP(A11,A5:B7,2,0)

Read more about VLOOKUP function at:

https://brainly.com/question/19372969

The blank function returns to the first character or characters in a text string based on the number of characters specified??? A. PROPER B. MID C. LEN D. LEFT

Answers

Answer: D.) LEFT

Explanation: LEFT is an excel function allows users to extract a specified number of characters starting from the left. The syntax goes thus :

=LEFT(text, [num_chars])

text: the original string in which characters are to be extracted.

num_chars : takes an integer, stating the number of characters to extract.

The proper function is also an excel function which sets the first character in each word to uppercase. The mid function is also used in text extraction starting from any position in the original string based on what is specified.

The LEN function is used to get the number or length of characters in a string.

What is the result of giving the which utility the name of a command that resides in a directory that is not in your search path

Answers

Answer and Explanation:

The result of providing the which utility the command name i.e not covered under the search path is as follows

The device that shows a notification that the command you are searching for is not in your query path's directory list. The utility in which no information is shown. Because the search path has always been about which utility therefore it would not be work.

all HTML tags are case sensitive, case insensitive and have to be written in capitals only​

Answers

Answer:

Html tags are not case sensitive

It's in JavaScript that the tags are case sensitive

Write the definition of the function displaySubMenu that displays the following menu; this function doesn't collect the user's input; only display the following menu:
[S]top – Press 'S' to stop.

Answers

Answer:

Using Python:

def displaySubMenu():

   print("[S]top – Press ‘S’ to stop.")

Using C++ programming language:

void displaySubMenu(){

cout<<"[S]top – Press ‘S’ to stop.";}

Explanation:

The function displaySubMenu() has a print statement that prints the following message when this function is called:

[S]top – Press 'S' to stop.

You can invoke this function simply by calling this function as:

displaySubMenu()

The function doesn't take any input from the user and just displays this message on output screen whenever this function is called.

In C++ you can simply call the function using following statement:

void main(){

displaySubMenu(); }

You are scanning a network to ensure it is as secure as possible. You send a TCP probe packet to a host with a FIN flag and receive a RST/ACK response. What does this mean?

Answers

Answer:

Hello your question lacks the required options here are the options

A)This response means the port he is scanning is open.

B)The RST/ACK response means the port Fred is scanning is disabled.

C)This means the port he is scanning is half open.

D) This means that the port he is scanning on the host is closed

answer : This means that the port he is scanning on the host is closed ( D )

Explanation:

When you scan a network to ensure it is secure enough by sending a TCP probe to a host with a FIN flag and you receive a RST/ACK response it means that The port that is been scanned on the host is closed

A TCP scanning/probe involves sending a number of packets to each port that is scanned. when you Compare TCP scanning methods to other methods of scans, a TCP Connect scan is typically slow and methodical.

zybooks cis 110 challenge activity 9.8.1 Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the 0's and 1's in reverse order. Ex: If the input is 6, the output is 011. Your program should define and call a function: Function Integer To Binary(integer num) returns nothing The function should output 1's and 0's representing the integer in binary (in reverse).

Answers

Answer:

public class IntegerToBinary

{

public static void main(String[] args) {

 integerToBinary(6);

}

public static void integerToBinary(int num){

    while(num > 0){

       System.out.print(num%2);

       num = Math.floorDiv(num, 2);

    }

}

}

Explanation:

*The code is in Java.

Create a function called integerToBinary that takes one parameter, num

Inside the function, create a while loop that iterates while the num is greater than 0. Inside the loop, print the num%2. Then, get the floor division of the num by to and assign it to the num.

Inside the main, call the function with parameter 6.


21. The quality of worth or merit, excellence and importance; custom or
ideal that people desire as an end, often shared within a group.
*

Answers

Answer:

Goals

Explanation:

Interestingly, the term goals refers to a perceived future a certain individual or group of individuals are hopeful for, or better still it could be an expectation of improved quality of worth or merit, excellence and importance; custom or ideals that people desire as an end, often shared within a group.

Remember, goals are desired end, achieved as a result of deliberate action or actions towards attaining it.

The IP protocol (and UDP) are called "connectionless" and "unreliable." Describe what those two words mean in the context of data communications?

Answers

Answer:

Explanation:

In data communications, a protocol is connectionless if it describes communication between two devices in a network without first establishing or verifying establishment of some link (connection) between the two devices. In a connectionless protocol, data are exchanged between processes or devices without a prior check of whether the processes are ready to transmit data or not. In this type of protocol, there's no verification put in place to remember if these processes were or are in communication. Connectionless protocols are also called stateless protocols. Because connectionless protocol cannot be relied upon due to its lack of delivery-assurance policy, it is sometimes referred to as unreliable protocol. In other words, delivery of data packets is not guaranteed. An example of a connectionless protocol is the UDP (User Datagram Protocol).

However, if the protocol defines some checks to ascertain that there is first a connection between two communicating processes before beginning transmission, then, the protocol is connection-oriented. An example of this is the TCP (Transmission Control Protocol). Connection-oriented protocols are reliable since they ensure connection be made between processes before transmitting data packets.

A typical application of a connectionless/unreliable protocol is in the streaming of real time videos or voice communication where packets of data could be dropped and not resent.

An example of the connection-oriented/reliable protocol is analogous to making a telephone call where data packets (voice messages) are not sent until the receiver on the other end makes a connection.

Open the Undergrad Debt data in the Excel file. Nationally, on average, a college student last year graduated with $27,200 in debt with a historical standard deviation of $5,000. The file gives sample date from Arkansas.
Does Arkansas students have higher debt than the national average at alpha equal to 10?

Answers

Answer:

Arkansas students have higher debt than the national average, $27,200.

Explanation:

The provided data is:

S = {24040, 19153, 26762, 31923, 31533, 34207, 14623, 24370, 31016}

In this case we need to test whether Arkansas students have higher debt than the national average at alpha equal to 0.10.

The hypothesis can be defined as follows:

H₀: Arkansas students does not have higher debt than the national average, i.e. μ ≤ $27,200.

Hₐ: Arkansas students have higher debt than the national average, i.e. μ > $27,200.

Compute the sample mean:

[tex]\bar x=\frac{1}{n}\sum X=\frac{1}{10}\times 213537=21353.70[/tex]

As the population standard deviation is provided, we will use a z-test for single mean.

Compute the test statistic value as follows:

[tex]z=\frac{\bar x-\mu}{\sigma/\sqrt{n}}=\frac{21353.70-27200}{5000/\sqrt{10}}=-3.70[/tex]

The test statistic value is -3.70.

Decision rule:

If the p-value of the test is less than the significance level then the null hypothesis will be rejected.

Compute the p-value for the test as follows:

 [tex]p-value=P(Z>-3.70)=P(Z<-3.70)=0.00011[/tex]

*Use a z-table for the probability.

The p-value of the test is 0.00011.

p-value = 0.00011 < α = 0.10

The null hypothesis will be rejected.

Thus, it can be concluded that Arkansas students have higher debt than the national average, $27,200.

Write a date transformer program using an if/elif/else statement to transform a numeric date in month/day format to an expanded US English form and an international Spanish form; for example, 2/14 would be converted to February 14 and 14 febrero

Answers

I wrote it in Python because it was quick so i hope this is helpful

Answer:

date = input('Enter Date: ')

split_date = date.split('/')

month = split_date[0]

day = split_date[1]

if month == '1':

   english_month = 'January'

   spanish_month = 'Enero'

elif month == '2':

   english_month = 'February'

   spanish_month = 'Febrero'

elif month == '3':

   english_month = 'March'

   spanish_month = 'Marzo'

elif month == '4':

   english_month = 'April'

   spanish_month = 'Abril'

elif month == '5':

   english_month = 'May'

   spanish_month = 'Mayo'

elif month == '6':

   english_month = 'June'

   spanish_month = 'Junio'

elif month == '7':

   english_month = 'July'

   spanish_month = 'Julio'

elif month == '8':

   english_month = 'August'

   spanish_month = 'Agosto'

elif month == '9':

   english_month = 'September'

   spanish_month = 'Septiembre'

elif month == '10':

   english_month = 'October'

   spanish_month = 'Octubre'

elif month == '11':

   english_month = 'November'

   spanish_month = 'Noviembre'

elif month == '12':

   english_month = 'December'

   spanish_month = 'Diciembre'

US_English = f'{english_month} {day}'

International_Spanish = f'{day} {spanish_month}'

print(f'US English Form: {US_English}')

print(f'International Spanish Form: {International_Spanish}')

Input:

3/5

Output:

US English Form: March 5

International Spanish Form: 5 Marzo

Explanation:

You start by taking input from the user then splitting that at the '/' so that we have the date and the month in separate variables. Then we have an if statement checking to see what month is given and when the month is detected it sets a Spanish variable and an English variable then prints it to the screen.

Hope this helps.

Write an expression using membership operators that prints "Special number" if special_num is one of the special numbers stored in the list special_list

Answers

Answer:

In python, the statement can be written as:

if(special_num in special_list): print("Special Number")

Explanation:

We need to create a list with the name 'special_list' with some values and then check whether special_num is in the list or not using the membership operator.

Membership operator in python: in

Let us do it step by step in python:

special_list = ['1', '2', '3','4']      #A list with the values 1, 2, 3 and 4

special_num = input("Enter the number to be checked as special \t")

#Taking the input from the user in the variable special_num.

if(special_num in special_list): print("Special Number")

#Using the membership operator in to check whether it exists in the list or not.

Please refer to the image attached for the execution of above program.

So, the answer is:

In python, the statement can be written as:

if(special_num in special_list): print("Special Number")

If no other row matches, the router will select the ________ row as its best match. First Last either First or Last, depending on the circumstances neither First nor Last

Answers

Answer:

Last

Explanation:

Routing is a term in engineering which involves the process of selecting a path for traffic in a network or across multiple networks. It is applicable in circuit-switched networks, such as the public switched telephone network (PSTN), and computer networks, such as the Internet. It is mostly used as a term for IP Routing.

Hence, in IP Routing, the first step is comparing the packet's destination IP address to all rows, followed by selecting the nest-match row. However, If no other row matches, the router will select the LAST row as its best match.

Make a simple numeric calculator. It should prompt the user for three numbers. Then add the numbers together and divide by 2. Display the result. Your program must support numbers with decimals and not just integers. If the result is more than 6, display Your result is more that 6! 4.

Answers

Answer:

No programming language stated; I'll answer this question using Python.

(Please note that -> at the last line means indentation)

The program is as follows:

num1 = float(input("Number 1: "))

num2 = float(input("Number 2: "))

num3 = float(input("Number 3: "))

result = (num1 + num2 + num3)/2

print("Result: ",result)

if result > 6:

->print("Your result is more than 6!")

Explanation:

The first three lines prompt the user for input of 3 numbers (the number could be decimal, whole numbers, positive or negative numbers)

num1 = float(input("Number 1: "))

num2 = float(input("Number 2: "))

num3 = float(input("Number 3: "))

The next line sums up user input and divides the sum by 2

result = (num1 + num2 + num3)/2

The next line prints the calculated result in the previous line

print("Result: ",result)

The next line determines if the calculated result is more than 6; if yes, the associated print statement is executed

if result > 6:

->print("Your result is more than 6!")

Once again, please note that -> at the last line means indentation

Which among the following enhances WS-Security to facilitate a mechanism for issuing, renewing, and validating security tokens?

a. WS-Trust
b. WS-SecureConversion
c. WS-SecurityPolicy
d. All of the mentioned

Answers

Answer:

a. WS-Trust

Explanation:

WS-Trust can be defined as a WS-specification as well as OASIS standard that help to provides extensions to WS-Security, in order to facilitate a mechanism for issuing, renewing, as well as validating of security tokens which is why the aim and objectives of WS-Trust is to help and enable applications to construct trusted SOAP message exchanges.

Nevertheless WS-Trust enables the issuance as well as the dissemination of credentials within several and various trust domains.

A web service using the WS-Trust can be used for implementing the standards that encode the WS security to facilitate the mechanisms for issuing and reviewing the security tokens.

Hence e the option A is correct. The  WS security token service is a service based on the mechanisms of the key exchange.

Learn more about the following enhances WS-Security to facilitate.

brainly.com/question/13171394.

Write a Java application with a main() to find the two largest distinct integers entered on the command line by the user. We are just creating a simple stand-alone application. All your code can be in main().

Answers

Answer:

import java.util.Scanner; // Scanner class is to use input output functions

public class TwoDistinctLargest //class to find two distinct largest nos

{

public static void main(String[] args) { //start of main() function

Scanner input = new Scanner(System.in); // creates Scanner type object

       int integers = 0, largest1 = 0, largest2 = 0; // declare variables

/* integers holds the input integer values, largest1 has 1st largest number and largest 2 contains second distinct largest number, i is used as the count variable to move through the input integers */

       int i = 0;  

//prompts user to enter integers and enter 0 to stop

       System.out.println("Enter the integers (press 0 to stop): ");

       integers = input.nextInt(); //reads and scans input integers

       while(integers != 0) {

/* the loop keeps taking integer values from user until the value of integers is equal to 0, this means until the user enters 0 */

//checks if the value of integer is greater than first largest computed number

           if(integers > largest1) {

//if the value in largest1 is greater than that of largest2

               if(largest1 > largest2) {

                   largest2 = largest1; } // then value of largest1 is set to largest2                

               largest1 = integers; // largest1 now holds the value of integers //which means largest1 holds the first distinct largest integer

           } else { //checks if the value of integers is greater than largest2

               if(integers > largest2) {

//if the value of integers is not equal to that of largest1

                   if(integers!=largest1)  {

// set the value of second distinct largest number to largest2

                   largest2 = integers;}              }            }

                     i++; //keeps moving to the next input integer

           integers = input.nextInt();     //keeps taking input integers    }      

//prints the two distinct largest integers

       System.out.println("\n The 1st largest distinct integer is " + largest1);

       System.out.println("\n The 2nd largest distinct integer is " + largest2); } }

Explanation:

Lets suppose the user inputs the following integers

1, 6, 5, 6, 0

Initial values are:

integers = 0

largest1 = 0

largest2 = 0

i = 0

When the user enters 1, then value of integers = 1

while loop checks if integers!=0. As integers =1 so the program enters the body of while loop. The first IF condition is checked if(integers > largest1)

As largest1 = 0 and integers =1 so this condition evaluates to true as 1 > 0

So the statements in the body of this IF condition are executed. This if conditions contains another if statement if(largest1 > largest2) which checks if the value largest1 is greater than that of largest2. Its false because largest1 =0 and largest2 =0 so largest1 = largest2, so the statement of this if condition body will not execute and program moves to this                 largest1 = integers; statement which sets the value of integers i.e. 1 to largest1. So the value of largest1 = 1

Now the i is incremented by 1 and it points at second value of integers= 6.

while loop checks if integers!=0. As integers =6 so the program enters the body of while loop. The first IF condition is checked if(integers > largest1)

As largest1 = 1 and integers =6 so this condition evaluates to true as 6>1

So the statements in the body of this IF condition are executed. This if conditions contains another if statement if(largest1 > largest2) which checks if the value largest1 is greater than that of largest2.

Its true because largest1 =1 and largest2 =0 so largest1 > largest2, so the next statement is executed largest2 = largest1; So now the value of largest2=1.

Now program moves to this largest1 = integers; statement which sets the value of integers i.e. 6 to largest1. So the value of largest1 = 6

Now the i is incremented by 1 and it points at second value of integers= 5.

while loop condition is again true. IF condition is checked if(integers > largest1)

As largest1 = 6 and integers =5 so this condition evaluates to false as 5<6. So this IF part will not execute and program control moves to the else part.

Else part has an if condition if(integers > largest2) which evaluates to true because integers = 5 and largest2 = 1 so the program moves to next if statement inside the previous if statement of else part i.e. if(integers!=largest1). This if statement is the main statement which will help in finding two distinct largest numbers in case the same largest value is input more than once. It checks If the value of integers is not equal to largest1 value. As integers = 5 and  largest1 = 6 so this if condition is true. If this condition is not used in this program then largest2 will not be assigned distinct largest values but assigned 6 for both largest1 and largest2 as 6 is input twice. Next this if statement  largest2 = integers assigns value of integers to largest2 which is the second largest distinct integer.

Now the i is incremented by 1 integers value become 0.

while loop checks if integers!=0. As integers =0 so the while loop breaks. The last two print statements which produce following output.

The 1st largest distinct integer is: 6

The 2nd largest distinct integer is: 5

Your mission is to read this uber-classified memo from the Grand Poobah of annan. Of course, it's in code, so you'll need to write a program to decrypt your message. The code is set up so that for the nth element in the array, you will need to read its nth letter. (Ex: if pirates is in array position 0, then print letter 0 of the word, which = p. if gangway is in array position 4, then print letter 4 = w.) To accomplish this, your main function should do the following: a. Declare 4 separate arrays of strings called secrets1, secrets2, secrets3, & secrets4 and assign them the following values: secrets1: { "platypus", "plethora","trend", "croak","almost", "toaster" }; secrets2: _{ "fire", "seen","trend", "produce" }; secrets3: { "tiretread", "chains", "stern", "bed bug" }; secrets4: {"oracle", "stetson","mother", "stie", "twigrot" }; b. Call the function decode 4 times - once for each array variable (secrets1, secrets2, secrets3 & secreets4) from Step a. (You'll have to do this with 4 lines of code; you can't use a loop for it.) c. Write a void function called decode that will i. Accept an array of strings, and the integer array length as the parameters. ii. Read through each word in the array. If the word is in the nth position of the array, then print the nth letter for that word. (For array item 0, print the letter at position 0 in the word. For array item 1, print the letter at position 1 in the word...etc.) Print all of the letters from this array on one line. iii. Print a blank

Answers

Answer:

Following are the code to this question:

#include<iostream>//declaring header file

using namespace std;  

void decode(string* arr, int n)//defining a method decode

{

for(int i = 0; i < n; i++)//defining a loop for print value

{

cout << arr[i][i] << " "; // using print method to print ith letter of the string

}

cout << endl;//line break

}

int main()//defining main method

{

string secret1[] = {"platypus","plethora","trend","croak","almost","toaster"};//defining string arry and assign value

string secret2[] = {"fire","seen","trend","produce"};//defining string arry and assign value

string secret3[] = {"tiretread","chains","stern","bed bug"};//defining string arry and assign value

string secret4[] = {"oracle","stetson","mother","stie","twigrot"};//defining string arry and assign value

decode(secret1, 6);//calling method decode and pass string array and integer number

decode(secret2, 4);//calling method decode and pass string array and integer number

decode(secret3, 4);//calling method decode and pass string array and integer number

decode(secret4, 5);//calling method decode and pass string array and integer number

return 0;

}

output:

Please find the attachment.

Explanation:

In the above C++ language code, a method "decode" is declared that accepts a string array and an integer variable in its parameter, inside the method a for loop is declared, which is used "n" variable to print its [tex]i^{th}[/tex] letter value in the given string value.  

In the main method,  4 string array "secret1, secret2, secret3, and secret4" is declared which assigns some value, and then we call the method "decode" and pass string array value and an integer value in its parameter.

The list of lists below is meant to represent the money raised by a charity over multiple days. The inner lists represent each donation, and the outer list represents each day. Use a for loop to calculate the sum of all the numbers in this list of list of numbers, to print the total amount of money raised.
code given:hourly_donations_per_day = [[44, 33, 56, 27, 33, 25],[12, 15, 22, 19, 21],[36, 34, 32, 37, 28, 11, 35],[20, 19, 29],[22, 27, 21, 15, 26, 15]]

Answers

Answer:

Following are the code to this question:

hourly_donations_per_day = [ #declaring list of lists and assign values

[44, 33, 56, 27, 33, 25],

[12, 15, 22, 19, 21],

[36, 34, 32, 37, 28, 11, 35],

[20, 19, 29],

[22, 27, 21, 15, 26, 15]

]

total_amount_of_money_raised = 0#defining a variable and assign a values 0

for i in hourly_donations_per_day:#defining loop to count values donation  

       if isinstance(i,list): #using if block to add donation values

               for j in i:#defining loop for add list values

                   total_amount_of_money_raised += j #add all values in total_amount_of_money_raised variable

print(total_amount_of_money_raised) #print value

Output:

714

Explanation:

In the above code, a list of the list is declared in which, it assigns the multiple values, in the inner lists it represents donation value and in the outer list it represents the day. In the next step, a variable "total_amount_of_money_raised" is declared that assigns a value 0, in the next step, multiple for loop is declared which is used to add list donation value and at the last print, the method is used to print its value.    
Other Questions
In the diagram, what is the measure of angle 1 to the nearest degree? a) 82 b) 92 c) 94 d) 98 Suppose that Spain and Germany both produce rye and olives. Spain's opportunity cost of producing a crate of olives is 5 bushels of rye while Germany's opportunity cost of producing a crate of olives is 10 bushels of rye.By comparing the opportunity cost of producing olives in the two countries, you can tell that_______has a comparative advantage in the production of olives and_______has a comparative advantage in the production of rye. Suppose that Spain and Germany consider trading olives and rye with each other. Spain can gain from specialization and trade as long as it receives more than______of rye for each crate of olives it exports to Germany. Similarly, Germany can gain from trade as long as it receives more than_______of olives for each bushel of rye it exports to Spain. Which of the following prices of trade (that is, price of olives in terms of rye) would allow both Germany and Spain to gain from trade? a. 9 bushels of rye per crate of olives.b. 15 bushels of rye per crate of olives.c. 8 bushels of rye per crate of olives.d. 3 bushels of rye per crate of olives. HELP YOU WILL GET 30 POINTS Naoya read a book cover to cover in a single session, at a rate of 55 pages per hour. After reading for 4 hours, he had 330 pages left to read. How long is the book? _____=pages How long did it take Naoya to read the entire book?______=hours Identify the initial value and rate of change for the graph shown? Simplify -4 -4 -4 BCA DAC and BAC DCA by: the vertical angle theorem.the alternate interior angles theorem.the reflexive property.None of these choices are correct. How did African Americans show pride in their heritage?A. Name changesB. studying Black HistoryC. Celebrating KwanzaaD. All of the above That answer is D key points that can be found in the realist philosophical position Choose the inequality that represents the following graph.+H+-5 -4 -3+4-2 -1012.35Choose 1 answer:2 Can someone please help me with this question Un_______ es un edificio muy alto You notice the flagpole at school vibrating in the breeze. You count the vibrations and find thatthe flagpole makes 20 complete vibrations in 10 seconds. You read somewhere that thisflagpole vibrates at a speed of 25 m/s when the wind is blowing. Find the wavelength of thesevibrations A team of four boys and five girls is to be chosen from a group of six boys and eight girls. How many different teams are possible? I take variable $b$, double it, and add four. I subtract $4b$ from this new expression, and divide the resulting difference by two. What is my final expression in simplest form? BIG Corporation advertises that its light bulbs have a mean lifetime, , of 2800 hours. Suppose that we have reason to doubt this claim and decide to do a statistical test of the claim. We choose a random sample of light bulbs manufactured by BIG and find that the mean lifetime for this sample is 2620 hours and that the sample standard deviation of the lifetimes is 650 hours.In the context of this test, what is a Type II error?A type II error is (rejecting/failing to reject) the hypothesis that is (less than/less than or equal to/greater than/greater than or equal to/not equal to/equal to) ____ when in fact, is (less than/less than or equal to/greater than/greater than or equal to/not equal to/equal to) ______. Which two compounds are used in batteries? sulfuric acid and potassium hydroxide, lithium hydroxide and nitric acid, potassium hydroxide and nitric acid ,sulfuric acid and ammonium hydroxide. Periodization is a useful concept to apply when:A. comparing the Jewish and Gregorian calendars.B. organizing the history of Mexico into three distinct units of time.C. constructing a narrative about a single moment in time.D. distinguishing between arguments made by two differenthistorians.SUBMIT The XYZ Fund had NAV per share of $17.50 on January 1, 2016. On December 31 of the same year, the fund's NAV was $19.47. Income distributions were $0.75, and the fund had capital gain distributions of $1.00. Without considering taxes and transaction costs, what rate of return did an investor receive on the XYZ Fund last year? Two species of fish had recently undergone sympatric speciation. The males of each species had a different coloring through which females could identify and choose a partner from her own species. After some time, pollution made the lake so cloudy it was hard for females to distinguish colors. What might take place in this situation? What is the purpose of an Argumentative Essay? How is an Argumentative Essay different from a Persuasive Essay?