Course Content
Python Data Types
Python Data Types
Check String
Very often it hits that we need to check for the presence of some character or word in the string, and in order to realize this, we should use such a key word as in. As a result, we get a boolean value: True if such a character or substring is present in the string, and False - in the opposite case. For a better understanding, let's look at an example.
string = 'Pear Lime Banana' print('Lime' in string) print('Mango' in string)
Task
You have a string. You should check that this line contains such substrings Lorem
, python
, consectetur
.
If there is such a substring, then calculate its length.
Thanks for your feedback!
Check String
Very often it hits that we need to check for the presence of some character or word in the string, and in order to realize this, we should use such a key word as in. As a result, we get a boolean value: True if such a character or substring is present in the string, and False - in the opposite case. For a better understanding, let's look at an example.
string = 'Pear Lime Banana' print('Lime' in string) print('Mango' in string)
Task
You have a string. You should check that this line contains such substrings Lorem
, python
, consectetur
.
If there is such a substring, then calculate its length.
Thanks for your feedback!
Check String
Very often it hits that we need to check for the presence of some character or word in the string, and in order to realize this, we should use such a key word as in. As a result, we get a boolean value: True if such a character or substring is present in the string, and False - in the opposite case. For a better understanding, let's look at an example.
string = 'Pear Lime Banana' print('Lime' in string) print('Mango' in string)
Task
You have a string. You should check that this line contains such substrings Lorem
, python
, consectetur
.
If there is such a substring, then calculate its length.
Thanks for your feedback!
Very often it hits that we need to check for the presence of some character or word in the string, and in order to realize this, we should use such a key word as in. As a result, we get a boolean value: True if such a character or substring is present in the string, and False - in the opposite case. For a better understanding, let's look at an example.
string = 'Pear Lime Banana' print('Lime' in string) print('Mango' in string)
Task
You have a string. You should check that this line contains such substrings Lorem
, python
, consectetur
.
If there is such a substring, then calculate its length.