Python : comparing tuples
I am trying to compare tuple A values with tuple B values , and make a 3rd
tuple with common values. This is my code so far. Any attepts i have made
to get a 3rd tuple with common values failed. Any help is apreciated.
#1st nr , print divs
x = int(raw_input('x=' ))
divizori = ()
for i in range(1,x):
if x%i == 0:
divizori = divizori + (i,)
print divizori
#2nd nr , print divs
y = int(raw_input('y=' ))
div = ()
for i in range(1,y):
if y%i == 0:
div = div + (i,)
print div
#code atempt to print commom found divs
No comments:
Post a Comment