curriculum/challenges/english/blocks/daily-coding-challenges-python/68af0687ef34c76c28ffa547.md
Given a string, determine if all the characters in the string are unique.
all_unique("abc") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(all_unique("abc"), True)`)
}})
all_unique("aA") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(all_unique("aA"), True)`)
}})
all_unique("QwErTy123!@") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(all_unique("QwErTy123!@"), True)`)
}})
all_unique("~!@#$%^&*()_+") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(all_unique("~!@#$%^&*()_+"), True)`)
}})
all_unique("hello") should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(all_unique("hello"), False)`)
}})
all_unique("freeCodeCamp") should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(all_unique("freeCodeCamp"), False)`)
}})
all_unique("!@#*$%^&*()aA") should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(all_unique("!@#*$%^&*()aA"), False)`)
}})
def all_unique(s):
return s
def all_unique(s):
seen = set()
for ch in s:
if ch in seen:
return False
seen.add(ch)
return True