39 lines
921 B
Python
39 lines
921 B
Python
def printit(L1,*args):
|
|
print(*L1,sep='\n')
|
|
if args:
|
|
print(*args,sep='\n')
|
|
|
|
def compare(L1,L2,*args):
|
|
if not args:
|
|
return L1 == L2
|
|
else:
|
|
ls = [L1,L2,*args]
|
|
rtv = True
|
|
for i in range(len(ls)-1):
|
|
rtv = rtv and ls[1]==ls[i+1]
|
|
return rtv
|
|
|
|
def Eratorsthene(N):
|
|
l = [ii for ii in range(1,N,1)]
|
|
i = 2
|
|
while len(l)>0 and i <= int((N+1)/2):
|
|
if not i in l : i += 1; continue
|
|
l = list(filter(lambda x: (x%i!=0 or x==i), l))
|
|
i += 1
|
|
for li in l: print(f"{li} is a prime number")
|
|
return l
|
|
|
|
def reverse(L,*args):
|
|
if type(L) != list: raise TypeError(f"Well, {L} is not a list.")
|
|
if args:
|
|
return [*L,*args][::-1]
|
|
return L[::-1]
|
|
|
|
if __name__ == '__main__':
|
|
L2=list(range(1,8))
|
|
printit(L2)
|
|
print(compare([1,2,3,4],[1,2,3,5]))
|
|
Eratorsthene(20)
|
|
L1=[1,2,3,4,5]
|
|
print(reverse(L1))
|