Skip to main content
Practice

coding-quiz-7

---
id: coding-quiz-7
title: Coding Quiz - Detecting Anagrams
description: Write a function to determine if two given strings are anagrams
tags:
- Coding Quiz
- Python
- Practical
sidebar_position: 13
isPublic: false
---

# Coding Quiz - Detecting Anagrams

An anagram is when you can rearrange one string to form another.

For example, rearranging the letters of `listen` can form the word `silent`, making these two strings anagrams.

In this coding problem, you need to write a function that determines whether two given strings are `anagrams`.

The function should take two strings as input and return `True` if they are anagrams of each other, otherwise return `False`.

<br />

```python title="Write Code"
def solution(str1, str2):
# Write your code here
return



Constraints

  • Input strings contain only lowercase alphabets.

  • The length of a string is between 1 and 100 inclusive.




Example Input and Output

  • Input: "listen", "silent"

  • Output: True


  • Input: "triangle", "integral"

  • Output: True

Want to learn more?

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