Посчитать количество слов в предложении -Python(Питон)

print(len(input().split(' ')))
msg="tester slacker word for student"
print(len(msg.split(' ')))
def total_words(string):
    return len(string.split(' '))
print("Total words in {msg} = {count}".format(msg=msg,count=total_words(msg)))

Leave a Comment