• 1
    Input and Output Data
    • Tasks
  • 2
    Conditions
    • Tasks
  • 3
    For Loop
    • Tasks
  • 4
    Strings
    • Tasks
  • 5
    While Loop
    • Tasks
  • 6
    Lists
    • Tasks
  • 7
    Two-Dimensional Arrays
    • Tasks
  • 8
    Dictionaries
    • Tasks
  • 9
    Sets
    • Tasks
  • 10
    Functions and Recursion
    • Tasks
  • к

Занятие 3. FOR cycle

Difficulty level:

Task«Removing vowels»

you & mdash; Communication engineer at the Odyssey-7 intergalactic station. A new energy -efficient communication protocol "Consonant" is used to send text messages to Earth. The peculiarity of this protocol is that to save traffic and energy, it automatically removes from any message all the lowercase (small) English vowels: 'a' a ',' e 'i', 'o', 'u'.

rn

all other symbols; & mdash; title vowels (a, e, i, o, u), all consonants, numbers, punctuation marks and gaps & mdash; The protocol leaves without changes, so as not to violate the structure and readability of critical data.

rn

your task:
Write a symbol program that will encode messages according to the rules of the Consonant protocol. The program should take one line of the text to the input and display its processed version.

rn

Requirements for implementation:
To solve only the basic constructions: Entry and output of the data, data, data, data. Cycle & nbsp; for & nbsp; for the enforcement of characters and the conditional operator & nbsp; if to check each symbol.

Input format

The initial message for coding (string, string). Can contain any characters.

Output format

An encoded message after the removal of lowercase English vowels (line, string).

Example

Input

Attendation! An Incoming Asteroid is Detected. EVACUATE IMMEDITELY.

Output

attntn! An NCMNG STRD S DTCTD. EVCT mmdtly.

Hint

There will be no clue here, decide for yourself!

main.py
Test 1
Test 2
Test 3
Test 4
Test 5
Test 6
Test 7
Test 8
Test 9
Test 10
Developer’s solution
# Получаем исходную строку от пользователя
original_string = input()

# Создаем пустую строку, в которую будем записывать результат
result_string = ""

# Определяем строку со строчными гласными, которые нужно удалить
vowels_to_remove = "aeiou"

# Запускаем цикл, который перебирает каждый символ в исходной строке
for char in original_string:
    # Проверяем условие: если текущий символ НЕ находится в строке с гласными
    if char not in vowels_to_remove:
        # Если условие истинно (символ не является строчной гласной),
        # добавляем его в конец нашей итоговой строки
        result_string = result_string + char

# Выводим на экран итоговую строку после всех преобразований
print(result_string)

🎉 Congratulations! 🎉

You did an excellent job with the task! It was a challenging problem, but you found the correct solution. You are one step closer to mastering programming! Keep up the good work, because every stage you pass makes you even stronger.

AD

Advertisement

red-snake blue-snake green-snake

Running your code...

Помощник ИИ

Привет! Я твой помощник по программированию. Задавай любые вопросы по Python, я могу рассказать о функциях, методах, обьяснить то, что тебе не понятно, а так же о текущей задаче!