Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Counting | String Methods
String Manipulation in Python
course content

Зміст курсу

String Manipulation in Python

String Manipulation in Python

1. Basic Concepts
2. String Methods
3. Strings Formatting

Counting

Let's consider some other methods that can be applied to strings. One of them can help us count the number of appearances of some symbol/substring within a string.

To count the number of symbol/substring in string use .count(symbol/substring) method. For example,

123
string = "String Manipulation in Python" print("letter i appeared", string.count('i'), "times in the string.") print("letter t appeared", string.count('t'), "times in the string.")
copy

Note

This method is case-sensitive to symbols. For the example above, string.count('m') will return 0, while string.count('M') will return 1.

Завдання

You are given string "Introduction to Python". You need to calculate the number of symbols 'o' and 't' in this string.

Завдання

You are given string "Introduction to Python". You need to calculate the number of symbols 'o' and 't' in this string.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 2. Розділ 1
toggle bottom row

Counting

Let's consider some other methods that can be applied to strings. One of them can help us count the number of appearances of some symbol/substring within a string.

To count the number of symbol/substring in string use .count(symbol/substring) method. For example,

123
string = "String Manipulation in Python" print("letter i appeared", string.count('i'), "times in the string.") print("letter t appeared", string.count('t'), "times in the string.")
copy

Note

This method is case-sensitive to symbols. For the example above, string.count('m') will return 0, while string.count('M') will return 1.

Завдання

You are given string "Introduction to Python". You need to calculate the number of symbols 'o' and 't' in this string.

Завдання

You are given string "Introduction to Python". You need to calculate the number of symbols 'o' and 't' in this string.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 2. Розділ 1
toggle bottom row

Counting

Let's consider some other methods that can be applied to strings. One of them can help us count the number of appearances of some symbol/substring within a string.

To count the number of symbol/substring in string use .count(symbol/substring) method. For example,

123
string = "String Manipulation in Python" print("letter i appeared", string.count('i'), "times in the string.") print("letter t appeared", string.count('t'), "times in the string.")
copy

Note

This method is case-sensitive to symbols. For the example above, string.count('m') will return 0, while string.count('M') will return 1.

Завдання

You are given string "Introduction to Python". You need to calculate the number of symbols 'o' and 't' in this string.

Завдання

You are given string "Introduction to Python". You need to calculate the number of symbols 'o' and 't' in this string.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Let's consider some other methods that can be applied to strings. One of them can help us count the number of appearances of some symbol/substring within a string.

To count the number of symbol/substring in string use .count(symbol/substring) method. For example,

123
string = "String Manipulation in Python" print("letter i appeared", string.count('i'), "times in the string.") print("letter t appeared", string.count('t'), "times in the string.")
copy

Note

This method is case-sensitive to symbols. For the example above, string.count('m') will return 0, while string.count('M') will return 1.

Завдання

You are given string "Introduction to Python". You need to calculate the number of symbols 'o' and 't' in this string.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 2. Розділ 1
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt