Avi Drucker / Feb 28 2022
Intermediate Python Practice
import sys; from IPython.display import Image
print("hello from python version", sys.version.split()[0])
# Image(url="https://nextjournal.com/data/QmSCh17aGJcrEho2NtCwYHa2pjm4xDoCwdrLJiriuTPpUu?filename=1024px-Python-logo-notext.png&content-type=image/png")
0.4s
lst = [1,2,3,4] # fixed list that I am not going to mutate / modify
a = [x for x in lst]
print(a)
0.3s
b = []
for x in lst:
b.append(x)
print(b)
0.3s
[x + 1 for x in lst if x % 2 == 0]
0.0s