Last active
November 23, 2021 02:19
-
-
Save MaodeColombia/2278df0d242a0a39358ebc82faf38560 to your computer and use it in GitHub Desktop.
Converting a function into a list comprehension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def times_tables(): | |
lst = [] | |
for i in range(10): | |
for j in range (10): | |
lst.append(i*j) | |
return lst | |
lst = [ i*j for i in range(10) for j in range (10)] | |
times_tables() ==lst |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment