You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
input1 = int(input("첫 번째 수를 입력하세요."))
input2 = int(input("두 번째 수를 입력하세요."))
num_list1 = range(1, input1+1)
num_list2 = range(1, input2+1)
d_list1 = []
d_list2 = []
sorted(num_list1)
sorted(num_list2)
for n1 in num_list1:
d1=input1%n1
if d1 == 0:
d_list1.append(n1)
for n2 in num_list2:
d2=input2%n2
if d2 == 0:
d_list2.append(n2)
cd_list = []
for n in range(len(d_list1))
if d_list1[n] == d_list2[n]:
cd_list.append(d_list1[n])
print(cd_list)
The text was updated successfully, but these errors were encountered:
input1 = int(input("첫 번째 수를 입력하세요."))
input2 = int(input("두 번째 수를 입력하세요."))
d_list1 = []
d_list2 = []
for n1 in range(1, input1+1):
if input1%n1 == 0:
d_list1.append(n1)
for n2 in range(1, input2+1):
if input2%n2 == 0:
d_list2.append(n2)
cd_list = []
for cd1 in d_list1:
for n in d_list2:
if cd1 == n:
cd_list.append(cd1)
print(cd_list)
불필요하게 더 쓰지 않고 바로 가져다 써도 된다.
(헷갈릴까봐 그리고 오류가 무서워서 자꾸 이렇게 하나하나 나누어서 쓴다.)
내가 한 것
The text was updated successfully, but these errors were encountered: