Python Tutorial for Beginners #3 - String Operations (Methods, Slicing, f-strings)
12views
1likes
05:20
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Learn Python string operations in this beginner-friendly tutorial! š
In this lesson, you will learn:
ā
Creating strings with single and double quotes
ā
String concatenation and repetition
ā
F-strings for easy formatting
ā
String methods: upper, lower, strip, split, join
ā
Indexing and slicing strings
š Timestamps:
0:00 - Introduction
0:22 - Creating Strings Explained
0:46 - Creating Strings Demo
1:51 - String Methods Explained
2:39 - String Methods Demo
3:50 - Slicing Explained
4:38 - Slicing Demo
5:49 - Recap
6:24 - End
š» Source Code: https://github.com/GoCelesteAI/python_strings
š Code from this lesson:
# String basics
greeting = "Hello"
name = "World"
message = greeting + ", " + name + "!"
# f-strings
age = 25
print(f"I am {age} years old")
# String methods
text = " Python Programming "
print(text.strip())
print(text.upper())
words = "a,b,c".split(",")
rejoined = "-".join(words)
# Slicing
word = "Python"
print(word[0]) # P
print(word[-1]) # n
print(word[0:3]) # Pyt
print(word[::-1]) # nohtyP
š Previous: Lesson 2 - Variables & Data Types
š Next: Lesson 4 - Numbers & Math
#Python #PythonTutorial #LearnPython #Programming #Strings #StringMethods