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

Що буде результатом виконання Даного коду?

S="Пайтон-мова програмування високого рівня"

if '' in s:

print('входить)

else:

print('не входить)

входить

не входить

Ответы

Автор ответа: abob334
0

Данный код содержит ошибку в переменной S, где используется заглавная буква "S" вместо строчной буквы "s", что приведет к ошибке выполнения программы.

Предположим, что ошибка в переменной была исправлена, тогда при выполнении данного кода будет выведено сообщение "входить". Это происходит потому, что в условии проверки наличия подстроки '' (пустой строки) в строке S, так как строка S содержит символы, то условие не будет выполнено и программа перейдет к выполнению ветви else, где будет выведено сообщение "не входить".

Таким образом, чтобы программа выводила "входить", необходимо изменить условие на if ' ' in S: или if '-' in S: (если мы ищем определенный символ в строке), где ' ' и '-' являются пробелом и дефисом соответственно, которые есть в строке S.

Похожие вопросы
Предмет: Английский язык, автор: marystepanyan27
186.
187.
188.
189.
190.
191.
192..
193.
194.
195.
196.
197.
198.
199.
200..
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
Bill always buys lottery tickets. (Special)
He flew to New York a fortnight ago. (Special)
They have forgotten to bring their exercise-books. (Alternative)
He was happy to see you. (Disjunctive) it
We shall choose some new dresses for Ann. (General)
He couldn't come because he was drunk. (Special)
We have finished our work. (Special)
You are not working hard enough. (Disjunctive)
Jane will invite 7 other people to the party. (Special)
Bill had to call her name several times before she heard him. (General)
We shall have to examine you again. (Special)
They took photos after the ceremony. (Special)
There was no butter on the table. (Disjunctive)
The letter has been posted already. (Alternative)
You must leave the country at once. (General)
Linda parked her car in the wrong place. (Special)
Max put all the dishes away after he had dried them. (Special)
The wind is blowing very strongly tonight. (Disjunctive)
You will be given the answer next week. (Alternative)
He had to wait for an hour before she came. (General)
They will send him to prison. (Sper-¹)
Mother has thrown your homework into the waste paper basket. (Special)
She will be here in half an hour. (Alternative)
of sids
dua ed Ulv
They are learning higher mathematics. (General)
He has a cold bath every day. (Disjunctive)
They had to speak in a whisper in order not to wake him up. (Special)
He was looking for his gloves at that moment. (Special)
He asn't paid the phone bill yet. (Disjunctive)
The children are waiting for their grandmother. (Alternative)
He always tries to please you. (General)
She apologized for starting without ine. (Special)
leaving early the next morning. (Special)
5m
12
asw I
02
UGY
lliw uoY
eid 101 gnidool

191-210
Предмет: Английский язык, автор: kadarin5