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

Can anyone help me with turning fractions into decimals 2 1/2
solve quadratic equation by factoring How do you do it 3k^2 + 72 = 33k
rewrite the expression without using a negative exponent 6m^-2
What is Germany in German?
How did southeast asia's colonial history produce increased tensions in vietnam ?
How many quarts in 24 pints?
Which text exemplifies the anti-Victorianism prevalent in the early twentieth century? a) Eminent Victorians b) Jungle Books c) Philistine Victorians d) The
What is a unit of area with dimensions 1unit x 1unit x 1unit= ?
use the function rule, y= 2x+5, to find the values of y when x =1,2,3,4. write the answers as ordered pairs that would be used to graph the function. show your
anita tosses 3 coins. what is the probability that all the coins will land tails up?