Lecture
Coding Quiz - Reverse Words
In this coding quiz, your task is to write a function that reverses a string using a stack data structure.
Write a function that receives a string, inserts each character into a stack, and then outputs the string in reverse order.
Write Your Code Here
def solution(input_string): # Write your code here return
Constraints
-
The length of the input string is between 1 and 100.
-
The string consists of lowercase alphabetic characters only.
Examples
-
Input:
"hello" -
Output:
"olleh"
-
Input:
"algorithm" -
Output:
"mhtirogla"
Lessons in this chapter · Review and Deepen Understanding of Python Data Structures
- 1. Review of Key Data Structures
- 2. Multiple-choice quiz
- 3. Fill-in-the-blank quiz
- 4. Coding Quiz - Reverse Words
- 5. Coding Quiz - Task Scheduling
- 6. Coding Quiz - Check for Value Existence
- 7. Coding Quiz - Find the First Non-repeating Character
- 8. What is a Tree?
- 9. Tree Implementation Techniques
- 10. Multiple-choice quiz
- 11. Coding Quiz - Find Minimum Odd Value
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help