From 68690c570b0ec56050dd012d49dd5adc4b922acb Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Tue, 23 May 2023 23:40:04 +0300 Subject: [PATCH] Update and rename is-perm.md to iterable-is-permutation.md --- .../python/s/{is-perm.md => iterable-is-permutation.md} | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename snippets/python/s/{is-perm.md => iterable-is-permutation.md} (64%) diff --git a/snippets/python/s/is-perm.md b/snippets/python/s/iterable-is-permutation.md similarity index 64% rename from snippets/python/s/is-perm.md rename to snippets/python/s/iterable-is-permutation.md index 1319bbd7c..3ba479caf 100644 --- a/snippets/python/s/is-perm.md +++ b/snippets/python/s/iterable-is-permutation.md @@ -1,15 +1,17 @@ --- title: Check if two iterables are permutations of each other +shortTitle: Iterable permutations type: snippet language: python -tags: [list] +tags: [list,string] cover: apples -dateModified: 2023-05-23 10:48:03 +0100 +dateModified: 2023-05-23T10:48:03+03:00 --- Check if two iterables are permutations of each other. -- Use `Counter` to verify that each element in both iterables appear an equal number of times. +- Use `len` to check if both iterables have the same length. +- Use `Counter` to verify that each element appears an equal number of times in both iterables. ```py from collections import Counter