1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vladimir79 [104]
3 years ago
6

The aim of this activity is to implement an algorithm that returns the union of elements in a collection. Although working with

sets is quick and easy in Python, sometimes we might want to find the union between two lists. Create a function called unite_lists, which uses a loop to go through both lists and return common elements. Do not use the built-in set function.
Computers and Technology
1 answer:
shusha [124]3 years ago
3 0

Answer:

The function in Python is as follows:

def unite_lists(A, B):

   union = []

   for elem in A:

       if elem in B:

           union.append(elem)

   return union

Explanation:

This defines the function

def unite_lists(A, B):

This initializes an empty list for the union list

   union = []

This iterates through list A

   for elem in A:

This checks if the item in list A is in list B

       if elem in B:

If it is present, the item is appended to the union list

           union.append(elem)

This returns the union of the two lists

   return union

You might be interested in
When communicating with sockets, a client process initiates a request for a connection and is assigned a port by the host comput
melamori03 [73]

Answer:

D. 80

Explanation:

By default, the port number for a web server is 80.

3 0
4 years ago
Read 2 more answers
What are some areas to fill out in the New Formatting Rule dialog box? Check all that apply. rule type function name condition c
spayn [35]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

In this question the given options are:

  1. rule type
  2. function name
  3. condition
  4. cell reference
  5. argument
  6. format

<u>The correct options to this question are:</u>

1. rule type  

3. condition

6.  format

These are the areas that can be used to fill out in the New Formatting Rule dialog box. Other options are not correct becuase these are not used to fill out new formatting rule dialog box.

6 0
3 years ago
Read 2 more answers
Write a function that accepts a pointer to a C-string as an argument and returns the number of words contained in the string. Fo
Anon25 [30]

Answer:

To preserve the original format of the answer, I've added it as an attachment

Explanation:

This line defines the function

int countWords(const char ptr){

   

This line initializes number of words to 0

   int words = 0;

The following iteration is repeated until the last character in the argument is reached

   while(*(ptr) != \0){

This checks if current character is blank

       if(*ptr==  ){

If yes, then it increments number of words by 1

        words++;

 }

This moves the pointer to the next character

       ptr++;

   }

This returns the number of words in the argument

   return words+1;

}

The main begins here

int main() {

This declares user input as a character of 200 length

   char userinput[200];

This prompts user for input

   cout << Enter a string: (200 max): ;

This gets user input

cin.getline(userinput, 200);

This passes the c-string to the function and also prints the number of words

cout << There are  << countWords(userinput)<< words;

Download cpp
4 0
3 years ago
The text size can be found in ?
Greeley [361]

Answer:

Microsoft word.

Explanation:

i am very sorry if the answer is wrong

3 0
3 years ago
Assume that you are able to do an exhaustive search for the key to an encrypted message at the rate of 100 Million trials per se
Len [333]

Answer:

Following are the solution to this question:

Explanation:

In point 1:

Trials frequency = \frac{100 \  million }{second}

calculating the main length of cryptography = 112 bit

\to 100\  Million = 1 \times 10^8

calculating the second year value:

\to 365 \times 24 \times 60 \times 60 =3153600\\\\

                                  =3.15 \times 10^7 \ seconds

Currently, in average , at least half the possible sleeves is being used to verify the encryption process:  2^{111} \ keys

\to \frac{2^{111} \time3s 10^6}{3.15 \times 10^7}\approx 8.22 \times 10^{20} \ years

the total time value will be 8.22 \times 10^{20} \ years

In point 2:

In cryptography, the common name is Triple DES (3DES), which would be the symmetric-key encrypted communication algorithm (TDEAor Triple DEA), which adds 3 times per block size only with the cryptographic method Data Encryption Standard ( DES).  

Algorithm:-

The key package involves four DES keys, K1, K2, and K3, each 56-bit (except parity bits), Triple DES includes. Its encoding algorithm is::  

ciphertext = EK3(DK2(EK1(plaintext)))

I.e. K1, DES encrypt, K2 decrypt, then K3 encrypt DES.  

The reverse is the decryption:  

plaintext = DK1(EK2(DK3(ciphertext)))

I.e. decrypt by K3, crypt by K2, decrypt by K1.  

Every three-bit authentication encrypts a 64-bit block.

Its middle procedure in each situation it's the reverse of the first operation. It improves the strength of the key second option algorithm which offers DES native support with key option 3.

4 0
3 years ago
Other questions:
  • A server provides the services to take you to the correct website domain when you type cengage.com in your web browser. If this
    7·1 answer
  • Which of the following is a dynamic lot-sizing technique that calculates the order quantity by comparing the carrying cost and t
    10·1 answer
  • In a large company today, you will often find an infrastructure that includes hundreds of small LANs linked to each other as wel
    7·1 answer
  • When is a chart legend used
    8·2 answers
  • Lenny is a cheese packer at Cheddar Express. He is paid $.52 for every case of cheese he packs and loads onto delivery pallets M
    12·1 answer
  • Someone please help me? Thanks!
    10·2 answers
  • _____ was just a sophomore when he began building computers in his dorm room at the University of Texas. His firm would one day
    14·1 answer
  • Which term describes the order of arrangement of files and folders on a computer?
    10·1 answer
  • Which of the following options is not located in the page setup dialog box?
    14·1 answer
  • An independent penetration testing company is invited to test a company's legacy banking application developed for Android phone
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!