curriculum/challenges/english/blocks/daily-coding-challenges-python/69a890af247de743333bd4ce.md
Given a string, determine if it has no repeating characters.
has_no_repeats("hi world") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(has_no_repeats("hi world"), True)`)
}})
has_no_repeats("hello world") should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(has_no_repeats("hello world"), False)`)
}})
has_no_repeats("abcdefghijklmnopqrstuvwxyz") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(has_no_repeats("abcdefghijklmnopqrstuvwxyz"), True)`)
}})
has_no_repeats("freeCodeCamp") should return False.
({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.
({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.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(has_no_repeats("Mississippi"), False)`)
}})
def has_no_repeats(s):
return s
def has_no_repeats(s):
for i in range(1, len(s)):
if s[i] == s[i-1]:
return False
return True