【发布时间】:2022-08-02 11:46:14
【问题描述】:
标签: python-3.x function loops
标签: python-3.x function loops
如果我的直觉是正确的,那么您要做的就是将列表的值放入您刚刚定义的函数中。如果是这种情况,请使用以下命令:
l1 = [10,20,30,40,50]
l2 = [10,30,40,50,10]
def fun_1(list1):
if(list1[0] == list1[4]):
print("both are same")
else:
print("both are not same")
def fun_2(list2):
if(list2[0] == list2[4]):
print("both are same")
else:
print("both are not same")
fun_1(l1)
fun_2(l2)
【讨论】: