Предмет: Информатика, автор: grigorewe

Многозадачная программа читает строку и число. Затем в переменную s1 она записывает строку, умноженную на число, а в переменную s2 — «склеенные» строку и число (пример — "мир11"). Если строка s1 или строка s2 чётной длины, то программа выдаёт "Получилось!". Напиши такую же программу.


Аноним: язык??
grigorewe: python

Ответы

Автор ответа: vimmortal2
2

Программа:

Python:

st = input()

num = int(input())

s1 = st * num

s2 = st + str(num)

if len(s1) % 2 == 0 or s2 % 2 == 0:

   print('Получилось!')

Объяснение:

В начале вводится строка и число, которые записываются в переменные st и num соответственно. Далее значению строки s1 присваивается произведение строки на число, после - строка s2 принимает склеенное значение строки и числа как строки. В предпоследней строке действует условный оператор if: если количество символов в строке s1 делится на 2 без остатка (остаток 0) или количество символов в строке s2 делится на 2 без остатка (остаток 0), то выводится "Получилось!" согласно условию.


ihtior123: not all arguments converted during string formatting
Похожие вопросы
Предмет: Українська мова, автор: vlad0003vlad
Предмет: Математика, автор: Аноним
Предмет: Английский язык, автор: npozhitkova03
In England about 93 per cent of children attend state school. The other 7 per cent attend private schools. A minority of these private schools are boarding schools where children live as well as study. Private schools are very expensive.
In Britain it is cimpulory between the ages of 5 and 16 years to receive some officially recognised form of schooling. For younger childre, there are a few state kindergartens, some private kindergartens and a few "nursery classe"in ordinary schools. They are opional. Primary school consists of a reception class, infant school and junior school. A reception class and infant school take a year. In junior school, pupils spend 5 years. At the age of five they go to infant schools where they learn first steps in reading, writing and using numbers.
When children leave infant school, at the age of seven, at the age of seven, they go to junior schools until they are about eleven years of age. Their school subjects include English, arithmetic, history, geography, nature study, swimming, music, art and organized games.
At about 11 or 12 children move to a new school, usually a,,comprehensive" that accepts all the children from three or four neighbouring junior schools. Changing to the "big" school is a great moment in life for them. At secondary schools want to develop the talents of each individual child. So they offer a wide choise of subjects, from art and craft, woodwork and domestic science to modern laguage, computer studies. There are no entrance examinations, all pupils move automatically to the next form at the end of the year. ПОЖАЛУЙСТА ПЕРЕВОД ТЕКСТА ДАЙТЕ))))Плииизз