Apr-29-2021, 11:51 AM
And a tip - whenever you have range(len(... there is a better way.
In this case
You may also want to look at list comprehensions. Not the best example, but
In this case
a = [1, 2, 3, 4, 5] for x in a: print(x)Reiterating Perfringo, but specifically this case. For x in a pulls the elements of the list a. You then print (using Python 3 syntax for the print statement)
You may also want to look at list comprehensions. Not the best example, but
a = [1,2,3,4,5] [print(x) for x in a]Gets it down to 2 lines