trejon8673 trejon8673
  • 16-01-2020
  • Computers and Technology
contestada

Two words are a ""reverse pair"" if each is the reverse of the other. Write a program that finds all the reverse pairs in the word list.

Respuesta :

dogacandu
dogacandu dogacandu
  • 17-01-2020

Answer:

The code written in python is attached.

Explanation:

  1. I defined a function called find_reverse_pairs
  2. The function accepts word_list as an input
  3. I import the library itertools to put all possible pairs in the word_list to a list called pairs. I also created an empty list reverse_pairs to collect the desired pairs.
  4. For all the pairs in the pairs list, if their length is equal and they are reverse of each other, I append the pair to the reverse_pairs list
Ver imagen dogacandu
Answer Link

Otras preguntas

compare the air pressure at the peak of Mt. Everest to the air pressure at sea level.
the difference between food chain and food web
what interaction between American Indians and European colonists was most important.? why?
What are some facts about Themistocles of Greece?   I know he was an Athenian general and politician. I have a project for history where I need to act JUST LIKE
3n-5=-8(6+5n) SOLVE
solving fraction equations:  Write the solution in simplest form 6 1/4 = z + 1 5/8
What's the scientific name of a flathead bullhead catfish?
A park is in the shape of a rectangle 2 miles long and 1.5 miles wide. How much shorter if you walk diaganolly across the park rather than along two sides?
list two ways that American Indians and European colonists were allies
How do parents pass their traits down to their offspring?