--- id: 69a890af247de743333bd4ce title: "Challenge 225: No Consecutive Repeats" challengeType: 29 dashedName: challenge-225 --- # --description-- Given a string, determine if it has no repeating characters. - A string has no repeats if it does not have the same character two or more times in a row. # --hints-- `has_no_repeats("hi world")` should return `True`. ```js ({test: () => { runPython(` from unittest import TestCase TestCase().assertIs(has_no_repeats("hi world"), True)`) }}) ``` `has_no_repeats("hello world")` should return `False`. ```js ({test: () => { runPython(` from unittest import TestCase TestCase().assertIs(has_no_repeats("hello world"), False)`) }}) ``` `has_no_repeats("abcdefghijklmnopqrstuvwxyz")` should return `True`. ```js ({test: () => { runPython(` from unittest import TestCase TestCase().assertIs(has_no_repeats("abcdefghijklmnopqrstuvwxyz"), True)`) }}) ``` `has_no_repeats("freeCodeCamp")` should return `False`. ```js ({test: () => { runPython(` from unittest import TestCase TestCase().assertIs(has_no_repeats("freeCodeCamp"), False)`) }}) ``` `has_no_repeats("The quick brown fox jumped over the lazy dog.")` should return `True`. ```js ({test: () => { runPython(` from unittest import TestCase TestCase().assertIs(has_no_repeats("The quick brown fox jumped over the lazy dog."), True)`) }}) ``` `has_no_repeats("Mississippi")` should return `False`. ```js ({test: () => { runPython(` from unittest import TestCase TestCase().assertIs(has_no_repeats("Mississippi"), False)`) }}) ``` # --seed-- ## --seed-contents-- ```py def has_no_repeats(s): return s ``` # --solutions-- ```py def has_no_repeats(s): for i in range(1, len(s)): if s[i] == s[i-1]: return False return True ```