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 picture was mixed overseas. Hong Kong’s Hang Seng Index fell 1.6%, under pressure from U.S. regulatory scrutiny on New York-listed Chinese companies. Stocks were more buoyant in Europe, where Frankfurt’s DAX surged 1.4%. Telegram, which does little policing of its content, has also became a hub for Russian propaganda and misinformation. Many pro-Kremlin channels have become popular, alongside accounts of journalists and other independent observers. This provided opportunity to their linked entities to offload their shares at higher prices and make significant profits at the cost of unsuspecting retail investors. At the start of 2018, the company attempted to launch an Initial Coin Offering (ICO) which would enable it to enable payments (and earn the cash that comes from doing so). The initial signals were promising, especially given Telegram’s user base is already fairly crypto-savvy. It raised an initial tranche of cash – worth more than a billion dollars – to help develop the coin before opening sales to the public. Unfortunately, third-party sales of coins bought in those initial fundraising rounds raised the ire of the SEC, which brought the hammer down on the whole operation. In 2020, officials ordered Telegram to pay a fine of $18.5 million and hand back much of the cash that it had raised. The S&P 500 fell 1.3% to 4,204.36, and the Dow Jones Industrial Average was down 0.7% to 32,943.33. The Dow posted a fifth straight weekly loss — its longest losing streak since 2019. The Nasdaq Composite tumbled 2.2% to 12,843.81. Though all three indexes opened in the green, stocks took a turn after a new report showed U.S. consumer sentiment deteriorated more than expected in early March as consumers' inflation expectations soared to the highest since 1981.
from id


Telegram Data-Diving // Pro Data
FROM American