Alex Ferguson
Alex Ferguson

Reputation: 107

What function does this syntax perform in python

Please explain the syntax in the arguments of the longestCommonPrefix function. This function takes a list of strings as inputs.

class Solution:
    def longestCommonPrefix(self, strs: List[str]) -> str:


Upvotes: 0

Views: 841

Answers (1)

blueteeth
blueteeth

Reputation: 3555

The arguments and the -> describe the type of the function.

def longestCommonPrefix(self, strs: List[str]) -> str:
    pass

So it takes one argument, strs which is a list of strings (List[str]).
Then it returns a string (str).

Upvotes: 2

Related Questions