📝 Python Strings Adventure - Day 8

Master the art of working with text in Python! 🎨

Step 1 of 7

1 Creating Strings 📝

💡 Learn: Strings are text in Python. You can use single quotes ' ' or double quotes " "!

Try this: Run the code and see different ways to create strings!
🤔 Pro Tip: Both 'text' and "text" work the same! Use whichever you prefer.

2 Joining Strings (Concatenation) ➕

💡 Discovery: You can join strings together using the + symbol!
Notice: Don't forget to add spaces! "Super" + "Hero" = "SuperHero", but "Super" + " " + "Hero" = "Super Hero"

3 String Magic Methods ✨

💡 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

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!