Last active
July 30, 2019 05:04
-
-
Save ChaitanyaBaweja/aa800e7c8b00bdba5397386f37e614fd to your computer and use it in GitHub Desktop.
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
old_list = [1, 2, 3, 4] | |
new_list = [i**3 if i%2 == 0 else i**2 for i in old_list] | |
print(new_list) # Output: [1, 8, 9, 64] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment