编写函数可以被11整除但不能被3整除

编写一个名为div11not3(start,stop)的函数,该函数接受两个整数参数start和stop,并返回所有整数的列表,这些整数在start和stop之间可以被11整除,但不能被3整除,包括在内。您可以假设start<=stop。

例子

div11not3(22, 88)
[22, 44, 55, 77, 88]

div11not3(100, 200)
[110, 121, 143, 154, 176, 187]

div11not3(44, 44)
[44]

你题目的解答代码如下:(如有帮助,望采纳!谢谢! 点击我这个回答右上方的【采纳】按钮)

def div11not3(start,stop):
    li = [x for x in range(start,stop+1) if x % 11 == 0 and x % 3 != 0]
    return li

print(div11not3(22, 88))
print(div11not3(100, 200))
print(div11not3(44, 44))