Concatenate Array of Strings
Concatenate all strings in array.
BeginnerPhase 6 - Category 2: Array & String CombinationsExample 10 of 10
concatenate-array-of-strings.py
1# Take array of strings2n = int(input("Enter number of strings: "))3arr = []4for i in range(n):5 arr.append(input(f"String {i+1}: "))67# Concatenate8result = "".join(arr)9print(f"Concatenated: {result}")
Output
Enter number of strings: 3 String 1: Hello String 2: World String 3: Programming Concatenated: HelloWorldProgramming
What's going on
Use join() to concatenate all strings.
Key Concepts:
join() concatenates strings
Empty string as separator
Creates single string
🔗Related Content
- 📖
Phase 6 - Learn Concepts
Review Phase 6 concepts and explanations
- 📝
Phase 6 - Quiz
Test your Phase 6 understanding with quiz questions
- 💻
Phase 6 - All Practice Problems
Explore all practice problems for Phase 6
- 🎓
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- 🧠
Logic Building Overview
Learn about the complete logic building curriculum