Skip to content

Instantly share code, notes, and snippets.

@ChaitanyaBaweja
Last active November 16, 2018 14:49
Show Gist options
  • Save ChaitanyaBaweja/d51b2a896d761e9e5d83864f462b3db1 to your computer and use it in GitHub Desktop.
Save ChaitanyaBaweja/d51b2a896d761e9e5d83864f462b3db1 to your computer and use it in GitHub Desktop.
list = [1, 2, 3, 4]
cube_list = []
for i in list:
cube_list.append(i**3)
print(cube_list) # Output: [1, 8, 27, 64]
@ChaitanyaBaweja
Copy link
Author

Find cube of all numbers in a list and store them in a new list using a for loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment