Answer to Question #303582 in Python for Cristelle Maddela

Question #303582

Create a Python script which will accept two positive integers and will display the COMMON DIVISORS.


I need the code to have an output.


1
Expert's answer
2022-02-28T08:30:33-0500
'''
    Create a Python script which will accept two positive integers
    and will display the COMMON DIVISORS.
    I need the code to have an output.
'''
x=0
y=0


while(x<=0):
    x = int(input("Enter first  number (>0): "))
while(y<=0):
    y = int(input("Enter second number (>0): "))
common_Div = []
for r in range(1, min(x, y)+1):
    if (x%r == 0 and y%r == 0):
        common_Div.append(r)
print(common_Div)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS