Convert python code to haskell
Budget: $10 – $30 USD
I have a code I want to switch from python to haskell
CODE:
#using list range to generate multiplicands of 5 less than 200
l1 = list(range(5,200,5))
#using list range to generate odd numbers b/w 300 to 250
l2 = list(range(299,250,-2))
#using list comprehension to generate multiplicands of 5 less than 200
l1 = [n for n in range(5,200,5)]
#using list comprehension to generate odd numbers b/w 300 to 250
l2 = [n for n in range(299,250,-2)]
#function to get the divisors of a number
def divisors(n):
divs = []
for i in range(1,n+1):
if(n%i==0):
divs.append(i)
return divs
# function to get the common divsiors b/w n and m
def commonDiv(n,m):
#getting divisors using the divisors function
div_n = divisors(n)
div_m = divisors(m)
# using list comprehension to get the intersection
com_div = [x for x in div_n if x in div_m]
return com_div
#function to find the greatestCommonDiv of n and m
def greatestCommonDiv(n,m):
# getting the commonDivs
com_divs = commonDiv(n,m)
# returning the maximum common divisor
return max(com_divs)
CODE:
#using list range to generate multiplicands of 5 less than 200
l1 = list(range(5,200,5))
#using list range to generate odd numbers b/w 300 to 250
l2 = list(range(299,250,-2))
#using list comprehension to generate multiplicands of 5 less than 200
l1 = [n for n in range(5,200,5)]
#using list comprehension to generate odd numbers b/w 300 to 250
l2 = [n for n in range(299,250,-2)]
#function to get the divisors of a number
def divisors(n):
divs = []
for i in range(1,n+1):
if(n%i==0):
divs.append(i)
return divs
# function to get the common divsiors b/w n and m
def commonDiv(n,m):
#getting divisors using the divisors function
div_n = divisors(n)
div_m = divisors(m)
# using list comprehension to get the intersection
com_div = [x for x in div_n if x in div_m]
return com_div
#function to find the greatestCommonDiv of n and m
def greatestCommonDiv(n,m):
# getting the commonDivs
com_divs = commonDiv(n,m)
# returning the maximum common divisor
return max(com_divs)