21
loading...
This website collects cookies to deliver better user experience
list1 = [1,2,3,4,5]
list2 = []
for number in list1:
list2.append(number**2)
print(list2)
list2 = [number**2 for number in list1]
list1 = [[1,2,3],[4,5,6]]
list2 = []
for data in list1:
for number in data:
list2.append(number**2)
print(list2)
list2 = [number**2 for data in list1 for number in data]
print('Looks like trouble_1...')
import pdb
# Correct code segment
pdb.set_trace()
# Code here might be a bit sus
os
library in python. It almost contains all the methods one is ever going to need to call the Operating System's operations.fruits = {tomato, apple, banana, orange}
veggies = {tomato, cabbage, potato, onion}
fruits.intersection(veggies)
time
library plays an important role.