write a program to accept a list and print another list with the cubes of the elements of first list.

–4 votes
asked Oct 6 by (90 points)

2 Answers

0 votes
answered Oct 7 by (140 points)
#!/usr/bin/env python3
# Author: David Boyd
# Description:
#     This program to accepts a list then prints another list with the cubes of
#     the elements of first list.
# Date: 2019/10/06

def main():

    # Declare variables
    roots = 10
    size = roots+1
    rootls = []
    squaredls = []

    # Create a list of numbers
    for i in range(size):

    # Square rootls
    for i in range(size):
        squared_num = i*i

    # Print lists
    print("Root\t| Square")
    for i in range(size):
        print(rootls[i], "\t|", squaredls[i])

# End Program
0 votes
answered 5 days ago by gameforcer
def cube_list(l:list):
    return list(map((lambda x: x**3), l))

lst = [1, 2, 3, 4]
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.