Add Characters Between Each Character
Add a character between each character.
IntermediatePhase 5 - Category 4: String TransformationExample 8 of 10
add-characters-between-each-character.py
1# Take string input2s = input("Enter a string: ")3char = input("Enter character to add: ")45# Add between characters6result = char.join(s)7print(f"Result: {result}")
Output
Enter a string: Hello Enter character to add: - Result: H-e-l-l-o
What's going on
Use join() to insert character.
Key Concepts:
char.join(s) joins characters
Inserts char between each
Returns new string
🔗Related Content
- 📖
Phase 5 - Learn Concepts
Review Phase 5 concepts and explanations
- 📝
Phase 5 - Quiz
Test your Phase 5 understanding with quiz questions
- 💻
Phase 5 - All Practice Problems
Explore all practice problems for Phase 5
- 🎓
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- 🧠
Logic Building Overview
Learn about the complete logic building curriculum