计算输入函数中的字符串数

2024-09-30 20:35:42 发布

您现在位置:Python中文网/ 问答频道 /正文

用户提供未定义数量的字符串作为输入;我们必须计算用户提供的字符串数

我试过:

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

多谢各位


Tags: no字符串用户infor数量exampledef