Skip to content

Instantly share code, notes, and snippets.

@ChaitanyaBaweja
Last active July 30, 2019 05:07
Show Gist options
  • Save ChaitanyaBaweja/64dedea2184478677faf55ce75abad93 to your computer and use it in GitHub Desktop.
Save ChaitanyaBaweja/64dedea2184478677faf55ce75abad93 to your computer and use it in GitHub Desktop.
old_list = [1, 2, 3, 4]
new_list = []
for i in old_list:
if i%2 == 0:
new_list.append(i**3)
else:
new_list.append(i**2)
print(cube_list) # Output: [1, 8, 9, 64]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment