In this video I cover how to user List Comprehensions in Python.
Пікірлер: 9
@PhrontDoor3 ай бұрын
Loved the presentation ... very clear. Also could use : itemArr = [ f'item{n}' for n in range(3) ] to avoid the str cast
@ZAR_KoWaLsKy_4 ай бұрын
Nice explanation! Trully useful for adding some extra spice to my projects. Keep up the good work buddy!
@TaylorsSoftware4 ай бұрын
Thank you! :)
@fusebox972519 күн бұрын
perhaps we can also use append function as i.append("new") for i in itemList)
@TaylorsSoftware17 күн бұрын
Absolutely! :)
@droid812Ай бұрын
Very clever on zooming the code, that was a great detail Question: Is it recomended to use this comprehension? i mean it kinda affects readability but, what are good uses for it?
@TaylorsSoftwareАй бұрын
Great question! You should use list comprehensions when you want to quickly loop through or generate a list with minimal conditional statements. You should avoid using it when you have multiple conditions. It will make troubleshooting and readability more difficult with too many conditions.