-1

The user provides an undefined number of strings as the input; we have to count number of strings the user provided.

I tried :

    def count(terms*): # Example count('IloveU','Iwantyou','No')
        count = 0
        for term in terms:
            count += 1
        print (count)

Thank you

1 Answers1

1

Almost there: Asterix has to be in front of the params not at the end.

def count(*terms): # Example count('IloveU','Iwantyou','No')
      count = 0
      for term in terms:
          count += 1
      print (count)
  
Andreas
  • 8,694
  • 3
  • 14
  • 38