Skip to main content
Practice

coding-quiz-1

---
id: coding-quiz-1
title: Coding Quiz - Reverse String
description: Write a function to reverse a string
tags:
- Coding Quiz
- String
- Reverse
- Python
sidebar_position: 4
isPublic: true
---

# Coding Quiz - Reverse String

In this coding quiz, you will write a function that reverses a given string.

Create a program that takes a `string` input from the user and outputs the string in reverse order.

For instance, if the input string is `"hello"`, the output should be `"olleh"`.

<br />

```python title="Write the Code"
def solution(s):
# Write your code here
return



Constraints

  • The length of the input string must be between 1 and 100.

  • The string will only contain lowercase alphabets.




Input and Output Examples

  • Input: "hello"

  • Output: "olleh"


  • Input: "world"

  • Output: "dlrow"

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.