curriculum/challenges/english/blocks/daily-coding-challenges-python/698a1a73ade5ac0e19180fa6.md
Given an array, determine if it is flat.
is_flat([1, 2, 3, 4]) should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_flat([1, 2, 3, 4]), True)`)
}})
is_flat([1, [2, 3], 4]) should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_flat([1, [2, 3], 4]), False)`)
}})
is_flat([1, 0, False, True, "a", "b"]) should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_flat([1, 0, False, True, "a", "b"]), True)`)
}})
is_flat(["a", [0], "b", True]) should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_flat(["a", [0], "b", True]), False)`)
}})
is_flat([1, [2, [3, [4, [5]]]], 6]) should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_flat([1, [2, [3, [4, [5]]]], 6]), False)`)
}})
def is_flat(arr):
return arr
def is_flat(arr):
for el in arr:
if isinstance(el, list):
return False
return True