用代码块功能插入代码
data=[["Tony",23,"AI"],["Tom",34,"electrical engineering"],["Amy",26,"AI"],["Sam",27,"Nursing"]]
我想要达到的结果
for循环筛选年龄在20到30之间的
data=[["Tony",23,"AI"],["Tom",34,"electrical engineering"],["Amy",26,"AI"],["Sam",27,"Nursing"]]
for循环筛选年龄在20到30之间的
data=[["Tony",23,"AI"],["Tom",34,"electrical engineering"],["Amy",26,"AI"],["Sam",27,"Nursing"]]
for l in data:
if 20 <= l[1] <= 30:
print(l)