word1 = input(“Введите первое слово: “) word2 = input(“Введите второе слово: “) len1 = len(word1) len2 = len(word2) len_sum = len1 + len2 + 2 print(len1, len2, len_sum)
To solve your problem, you can use the built-in function 'len()' to determine the length of each word and then add 2 for the spaces in between. This will give you the total number of characters in both words. Here's an example:word1 = input('Введите первое слово: ')
word2 = input('Введите второе слово: ')
len1 = len(word1)
len2 = len(word2)
len_sum = len1 + len2 + 2
print(len1, len2, len_sum)
The result will be the length of the first word, the length of the second word, and the sum of the two lengths plus 2. For instance, if you entered 'apple' and 'orange', the output would be: 5 6 13.
Keep in mind, this solution assumes that you want the number of characters and not the number of letters or words. If you need something different, please specify in your input. Happy coding! - Academia Ninja