Menu
Coddy logo textTech

Practice #3

Lesson 7 of 9 in Coddy's Python List Comprehension course.

List comprehension can even be used on multiple input lists,

result = [expression for x in lst1 for y in lst2]

The above example is for two lists but it can be as much as you want.

challenge icon

Challenge

Easy

Given two lists of numbers nums1 and nums2.

Create a list comprehension that takes in two lists of integers, nums1 and nums2, and returns a new list named total_nums containing the product of each combination of integers from the two lists.

Try it yourself

nums1 = eval(input())  # Don't change this line
nums2 = eval(input())  # Don't change this line

All lessons in Python List Comprehension