element in list
if 2 in [1, 2, 3]:
print('2 in list')
else:
print('2 in not list')
if 4 in [1, 2, 3]:
print('4 in list')
else:
print('4 in not list')
if (1,2) in [(1, 2) , (3, 2)]:
print('(1,2) in list')
else:
print('(1,2) in not list')
result
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFFZN8gZJlcztcGReVzYd1zTgehVpwnqV3Up2f3kSMoDGSEfjxu0xE-SlN29MKQX7pcU8wqskKGhyphenhyphen2fy95Bs5JyN1c7XNgYl9ybk7qC8RlxuNttvzaEgZUUDwBOZ7dZvGdXd-WmCbVWDI/s200/%25E1%2584%2589%25E1%2585%25B3%25E1%2584%258F%25E1%2585%25B3%25E1%2584%2585%25E1%2585%25B5%25E1%2586%25AB%25E1%2584%2589%25E1%2585%25A3%25E1%2586%25BA+2017-12-14+%25E1%2584%258B%25E1%2585%25A9%25E1%2584%2592%25E1%2585%25AE+10.12.08.png)
element no in list
if 4 not in [1, 2, 3]:
print('4 not in list')
else:
print('4 in list')
if (1,2) not in [(1, 2), (3, 2)]:
print('(1,2) in not linst')
else:
print('(1,2) in list')
result
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgNSFKfwht7flCceivYawA0pGqHYVw0DcjM4BsRpPbUXiQSKneU-P7TF4rBPpEi_o42jFOf7dzJr7CczfXhRstvhpq1myf07ZFeLO0L2CtURybPo5wuEqC5cK7wgj8scVgNji56sXSn4o/s200/%25E1%2584%2589%25E1%2585%25B3%25E1%2584%258F%25E1%2585%25B3%25E1%2584%2585%25E1%2585%25B5%25E1%2586%25AB%25E1%2584%2589%25E1%2585%25A3%25E1%2586%25BA+2017-12-14+%25E1%2584%258B%25E1%2585%25A9%25E1%2584%2592%25E1%2585%25AE+10.13.18.png)
No comments:
Post a Comment