PY_PROBLEMS_LIB Telegram 1086
Напишите однострочник, который будет подсчитывать количество заглавных букв в файле

В этом однострочнике мы открываем файл ‘filename.txt’ и пробегаемся по всем его строкам и символам в каждой строке.

Для каждого символа, который является заглавной буквой метод isupper() возвращает True, и мы добавляем 1 к счетчику с помощью функции sum(). В конце, num_uppercase будет содержать количество заглавных букв в файле.



tgoop.com/py_problems_lib/1086
Create:
Last Update:

Напишите однострочник, который будет подсчитывать количество заглавных букв в файле

В этом однострочнике мы открываем файл ‘filename.txt’ и пробегаемся по всем его строкам и символам в каждой строке.

Для каждого символа, который является заглавной буквой метод isupper() возвращает True, и мы добавляем 1 к счетчику с помощью функции sum(). В конце, num_uppercase будет содержать количество заглавных букв в файле.

BY Библиотека задач по Python | тесты, код, задания




Share with your friend now:
tgoop.com/py_problems_lib/1086

View MORE
Open in Telegram


Telegram News

Date: |

The SUCK Channel on Telegram, with a message saying some content has been removed by the police. Photo: Telegram screenshot. For crypto enthusiasts, there was the “gm” app, a self-described “meme app” which only allowed users to greet each other with “gm,” or “good morning,” a common acronym thrown around on Crypto Twitter and Discord. But the gm app was shut down back in September after a hacker reportedly gained access to user data. The administrator of a telegram group, "Suck Channel," was sentenced to six years and six months in prison for seven counts of incitement yesterday. Judge Hui described Ng as inciting others to “commit a massacre” with three posts teaching people to make “toxic chlorine gas bombs,” target police stations, police quarters and the city’s metro stations. This offence was “rather serious,” the court said. Avoid compound hashtags that consist of several words. If you have a hashtag like #marketingnewsinusa, split it into smaller hashtags: “#marketing, #news, #usa.
from us


Telegram Библиотека задач по Python | тесты, код, задания
FROM American