This video is a tutorial on using string methods and slicing in Python. The video explains what methods are, how to use them, and how to slice strings to extract specific parts of the text. The video covers commonly used string methods, including lower(), upper(), replace(), startswith(), endswith(), and split(). It also demonstrates how to use slicing to access specific characters or substrings from a string. The video includes practical examples and exercises to help viewers practice these concepts.
First video about strings:
• Operations with STRINGS you should know in... - watch it!
Practical tasks:
Task 1:
Create a string that contains the word "don't" and then use the split() method to split the string into two separate words.
Expected outcome: "I don't know" → ["I", "don't", "know"]
Task 2:
Create a string that contains a mix of uppercase and lowercase letters. Then use the title() method to convert the first letter of each word to uppercase.
Expected outcome: "harry potter and the goblet of fire" → "Harry Potter And The Goblet Of Fire"
Task 3:
Create a string that contains a sentence with multiple spaces between words. Then use the split() method with no arguments to split the sentence into a list of words without the extra spaces.
Expected outcome: " The quick brown fox " → ["The", "quick", "brown", "fox"]
Task 4:
Create a string that contains a sentence with a word repeated multiple times. Then use the replace() method to replace all instances of that word with a different word.
Expected outcome: "I love love love ice cream" → "I love adore adore ice cream"
#python #programming #strings
On this page of the site you can watch the video online PYTHON STRINGS. Methods and slicing + practical tasks with a duration of hours minute second in good quality, which was uploaded by the user Python Now 18 April 2023, share the link with friends and acquaintances, this video has already been watched 55 times on youtube and it was liked by 1 viewers. Enjoy your viewing!