Skip to content

Created math.py - #16

Open
keshavgbpecdelhi wants to merge 1 commit into
codesankalp:mathsfrom
keshavgbpecdelhi:maths
Open

Created math.py#16
keshavgbpecdelhi wants to merge 1 commit into
codesankalp:mathsfrom
keshavgbpecdelhi:maths

Conversation

@keshavgbpecdelhi

@keshavgbpecdelhi keshavgbpecdelhi commented Sep 17, 2020

Copy link
Copy Markdown
Collaborator

Right now this consists of these functions which are as follows :
list_hcf(l) - HCF of a list
list_prime(l) - Primes in a list
next_prime(n) - next prime of a number
prev_prime(n) - previous prime of a number
list_lcm(a) - LCM of a list
hcf_k_elements(l,k) - HCF of k elements in a list
lcm_k_elements(l, k) - LCM of k elements in a list
where k and n implies numbers (integers) and l implies list.
Fixes #14

Right  now this consists of these functions which are as follows :
list_hcf(l) - HCF of a list
list_prime(l) - Primes in a list
next_prime(n) - next prime of a number
prev_prime(n) - previous prime of a number
list_lcm(a) - LCM of a list
hcf_k_elements(l,k) - HCF of k elements in a list
lcm_k_elements(l, k) - LCM of k elements in a list
where k and n implies numbers (integers) and l implies list.
Comment thread dsalgo/math.py
Comment on lines +7 to +13
#list_hcf(l) - HCF of a list
#list_prime(l) - Primes in a list
#next_prime(n) - next prime of a number
#prev_prime(n) - previous prime of a number
#list_lcm(a) - LCM of a list
#hcf_k_elements(l,k) - HCF of k elements in a list
#lcm_k_elements(l, k) - LCM of k elements in a list

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keshavgbpecdelhi add these single-line comments in function themselves or create a docstring for them

Comment thread dsalgo/math.py
Comment on lines +70 to +79
# def nextPrime(n):
# while True:
# n+=1
# for i in range(2,n):
# if n%i == 0:
# break
# else:
# return n

# print(nextPrime(1))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this code block is commented?

Comment thread dsalgo/math.py
Comment on lines +97 to +117
# def lcm(x,y):
# '''
# args:
# :integer: (number) : a integer number
# :algo: (integer): lcm of two numbers
# return:
# lcm of the two numbers
# '''
# res=0
# mx=max(x,y)
# mn=min(x,y)
# for i in range(1,mx+1,1):
# temp=mx*i
# try:
# if(temp%mn==0):
# res=temp
# break
# except ZeroDivisionError:
# res=0
# break
# return res

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this if it is not required @keshavgbpecdelhi

Comment thread dsalgo/math.py
Comment on lines +158 to +160



Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only two lines are necessary. Why you use three?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants