Leetcode longest common prefix, code running problem

there is a problem with the longest common prefix on leetcode. I want to solve it in a different way, but what I typed is:
fl
fl
flo
Why does print have three results?

class Solution:

def inter_prefix(self,strs=list,minPrefix=str):
    if minPrefix == "": return minPrefix

    for i in range(len(strs)):
        mi = strs[i][:len(minPrefix)]
        if minPrefix != mi:
            minPrefix = minPrefix[:-1]
            self.inter_prefix(strs, minPrefix)
    print(minPrefix)
def longestCommonPrefix(self, strs):
    """
    :type strs: List[str]
    :rtype: str
    """
    if not strs: return ""
    minPrefix = strs[0]
    -sharp if len(strs) == 1:return (minPrefix)
    for i in range(len(strs)):
        if len(minPrefix) > len(strs[i]):
            minPrefix = strs[i]
    self.inter_prefix(strs,minPrefix)

if name ="_ _ main__":

Solution().longestCommonPrefix(["flower","flow","flight"])
Mar.12,2021

because you use recursion, the function returns print from inside to outside.

to sum up your ideas, you can write like this.

def longest_common_prefix(strs):
    if not strs:
        return ''
    -sharp 
    prefix = min(strs, key=lambda s:len(s))
    while True:
        for i in strs:
            -sharp 
            if not i.startswith(prefix):
                prefix = prefix[:-1]
                break
        -sharp while
        else:
            break
    return prefix
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b368f5-2c016.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b368f5-2c016.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?