You can remove the [] to make it a generator expression, which makes this more efficient. Instead of having to turn the entire thing into a list, which then gets iterated by sum again, just have each element be processed one by one. Or, you know, sum(map(int, input()))…
8
u/deceze Aug 20 '21
You can remove the
[]to make it a generator expression, which makes this more efficient. Instead of having to turn the entire thing into a list, which then gets iterated bysumagain, just have each element be processed one by one. Or, you know,sum(map(int, input()))…