Skip to content

Instantly share code, notes, and snippets.

@geekykant
Created September 26, 2019 05:43
Show Gist options
  • Save geekykant/bfe889eeb57244f2c3ce444e311dd337 to your computer and use it in GitHub Desktop.
Save geekykant/bfe889eeb57244f2c3ce444e311dd337 to your computer and use it in GitHub Desktop.
def isprimebad(n):
if n < 2:
return(False)
else:
for i in range(2,n):
if n%i == 0:
return(False)
return(True)
def lexsortbad(l):
for j in range(len(l)-1):
for i in range(len(l)-1):
if l[i][0] > l[i+1][0]:
(l[i],l[i+1]) = (l[i+1],l[i])
return(l)
elif x >= w and x >= y and x >= z:
maximum = x
elif y >= w and y >= x and y >= z:
maximum = y
else:
maximum = z
def sumofsquares(n) :
i = 1
while i * i <= n :
j = 1
while(j * j <= n) :
if (i * i + j * j == n) :
return True
j = j + 1
i = i + 1
return False
def subsequence(sub, main):
flag = True
for item in sub:
if(item in main):
main.remove(item)
else:
flag = False
return flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment