Telegram Group & Telegram Channel
🧠 Ответ к Python-задаче

Давайте разберём, как может выглядеть программа, что считает количество гласных в тексте 👀

1️⃣ Цикл и список
example = example.lower()
list_of_vowels = ['у','е','а','о','э','я','и','ю','ы','ё']
count_of_vowels = 0
for i in list_of_vowels:
count_of_vowels += example.count(i)
print(count_of_vowels)

2️⃣ Цикл и логический оператор
example_lower = example.lower()
count_of_vowels = 0

for i in range(len(example_lower)):
if example_lower[i] in 'уеаоэяиюыё':
count_of_vowels += 1

print(count_of_vowels)

3️⃣ Функция map()
sum(map(example.lower().count, "уеаоэяиюыё"))

4️⃣ Регулярные выражения
import re
len(re.findall(r"[уеаоэяиюыё]", example.lower()))

Количество гласных в нашем примере — 629, а отрывок из «Мёртвых душ» Н. В. Гоголя💀🪶

Ставьте ❤️, если понравилась рубрика, и 🔥, если хотите продолжения

@data_analyst_pro
🔥3720👍4🤯1



group-telegram.com/data_analyst_pro/354
Create:
Last Update:

🧠 Ответ к Python-задаче

Давайте разберём, как может выглядеть программа, что считает количество гласных в тексте 👀

1️⃣ Цикл и список
example = example.lower()
list_of_vowels = ['у','е','а','о','э','я','и','ю','ы','ё']
count_of_vowels = 0
for i in list_of_vowels:
count_of_vowels += example.count(i)
print(count_of_vowels)

2️⃣ Цикл и логический оператор
example_lower = example.lower()
count_of_vowels = 0

for i in range(len(example_lower)):
if example_lower[i] in 'уеаоэяиюыё':
count_of_vowels += 1

print(count_of_vowels)

3️⃣ Функция map()
sum(map(example.lower().count, "уеаоэяиюыё"))

4️⃣ Регулярные выражения
import re
len(re.findall(r"[уеаоэяиюыё]", example.lower()))

Количество гласных в нашем примере — 629, а отрывок из «Мёртвых душ» Н. В. Гоголя💀🪶

Ставьте ❤️, если понравилась рубрика, и 🔥, если хотите продолжения

@data_analyst_pro

BY Data-Diving // Pro Data


Warning: Undefined variable $i in /var/www/group-telegram/post.php on line 260

Share with your friend now:
group-telegram.com/data_analyst_pro/354

View MORE
Open in Telegram


Telegram | DID YOU KNOW?

Date: |

The fake Zelenskiy account reached 20,000 followers on Telegram before it was shut down, a remedial action that experts say is all too rare. Meanwhile, a completely redesigned attachment menu appears when sending multiple photos or vides. Users can tap "X selected" (X being the number of items) at the top of the panel to preview how the album will look in the chat when it's sent, as well as rearrange or remove selected media. He said that since his platform does not have the capacity to check all channels, it may restrict some in Russia and Ukraine "for the duration of the conflict," but then reversed course hours later after many users complained that Telegram was an important source of information. In this regard, Sebi collaborated with the Telecom Regulatory Authority of India (TRAI) to reduce the vulnerability of the securities market to manipulation through misuse of mass communication medium like bulk SMS. The regulator took order for the search and seizure operation from Judge Purushottam B Jadhav, Sebi Special Judge / Additional Sessions Judge.
from us


Telegram Data-Diving // Pro Data
FROM American