Code: Select all
list1 =["python", "helloworld", 2013,2024,3]
list2=[1,2,3,4,5,6]
print(cmp(list1, list2))
print(cmp(list2, list1))
Moderators: mindphp, ผู้ดูแลกระดาน
Post by jirawoot » 19/06/2019 4:21 pm
Code: Select all
list1 =["python", "helloworld", 2013,2024,3]
list2=[1,2,3,4,5,6]
print(cmp(list1, list2))
print(cmp(list2, list1))
Post by tatiya » 19/06/2019 6:47 pm
Post by tatiya » 19/06/2019 6:50 pm
Code: Select all
list1 =["python", "helloworld", 2013,2024,3]
list2=[1,2,3,4,5,6]
def cmp(a, b):
return (a > b) - (a < b)
print(cmp(list1, list2))
print(cmp(list2, list1))
Return to “Programming - C/C++ & java & Python”
Users browsing this forum: No registered users and 3 guests