💡Cool Tools: Strings have special powers called methods! Try these out!
.upper() - Makes everything UPPERCASE
"hello".upper() → "HELLO"
.lower() - makes everything lowercase
"HELLO".lower() → "hello"
.title() - Makes Every Word Start With Capital
"hello world".title() → "Hello World"
4 String Slicing 🔪
💡Cool Trick: You can grab parts of a string! Each letter has a position (starting at 0).
Example: In "HELLO", H is position 0, E is position 1, etc.
🎯Quick Guide: • word[0] = first letter
• word[0:3] = letters 0, 1, 2 (not 3!)
• word[:3] = from start to position 3
• word[3:] = from position 3 to end
5 Quick Quiz! 🎯
🤔Test Time: What will this code print? Click your answer!
text = "Hello"
print(text[1:4])
A) Hello
B) ell
C) Hel
D) ello
🎉Correct! text[1:4] means positions 1, 2, 3 (not 4), which gives us "ell"!
6 F-Strings (The Easy Way!) 🚀
💡Super Power: F-strings make it super easy to put variables inside text! Just add f before the quotes and use {variable}.
✨Why F-strings Rock: Instead of "Hello " + name, just write f"Hello {name}"! Much easier! 🎉
7 Final Project: Story Creator 📖
🚀Big Challenge: Create a story using everything you learned! Run it and fill in your answers!
💪Extra Challenge: Can you add more inputs to make the story longer? Try adding an action or an animal!
🎉 You're a Python String Master! 🎉
You've learned how to create, join, slice, and format strings like a pro! Keep practicing!