Why Append Beats Concatenation
Both functions build the same list of n integers:
def build_a(n: int) -> list[int]:
result = []
for i in range(n):
result.append(i)
return result
def build_b(n: int) -> list[int]:
result = []
for i in range(n):
result = result + [i]
return result
Select all statements below that are true.
Sign in to answer questions and track your progress
Sign In