samedi 27 juin 2020

How many words from the array A and array B are used in the user input?

This is a program where I need some help

   A = ["having", "had", "is"]
   B = ["will", "would", "should"]

   sentence = input("Enter a sentence") #E.g. 'I will be having it in the future'

   if A in sentence:
      ...

   elif B in sentence:
      ...

Here I need to know how many words from the array A and array B are used in sentence.

The output here should be:
There is 1 word from A & 1 word from B in the sentence

Can you help me out please?

Aucun commentaire:

Enregistrer un commentaire