Если дано предложение со списком из нескольких утверждений, разделите их и создайте отдельное предложение.
Например
Ввод будет следующим:
“I need milk, eggs, and cheese from the store.”
Вывод будет следующим:
“I need milk from the store.
I need eggs from the store.
I need cheese from the store.”
Мой код прямо сейчас
# string
text = "I shall need milk, eggs, and cheese from the store."
# if there is a shall statement, continue
if "shall" in text:
# use split function
text = text.split(',')
# print each argument in a different line
for i in text:
print(i)
Подробнее здесь: https://stackoverflow.com/questions/786 ... ultiple-st
Напишите скрипт Python, который, если дано одно предложение со списком из нескольких операторов, разделит их и сделает о ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение