Загрузка...

How to Count capital letters in Python | Simple One-liner #python #pythonforbeginners #pythonshorts

Want to quickly count capital letters in a string using Python? 🤔
In this YouTube Short, I’ll show you how to write a one-liner Python expression to get the count of uppercase letters in any sentence.

📌 Code Used:
# Capital letters counter
my_letter = 'MY COUNT is what'
count_cap = sum(1 for c in my_letter if c.isupper())
print(count_cap)

🧠 Output: 7
Yes! It found 7 capital letters in the string. Fast, simple, and effective 💥

Subscribe to the channel for more Python mini-tips like this! 🚀

#PythonShorts #PythonTips #CodingShorts #LearnPython #PythonOneLiner #PythonBasics #CodeSnippet #DeveloperLife #datawizvamshi

Видео How to Count capital letters in Python | Simple One-liner #python #pythonforbeginners #pythonshorts канала DataWiz Vamshi
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять