Пользовательская функция программы Python - PullRequest
0 голосов
/ 03 мая 2018
    def challenge(nums=[],maxes=[]):
    okc=[]
    for el in maxes:
        for le in nums:
            if el>=le:
                okc.append(le)
    print("The final array is:{}".format(okc))


print("Enter the length of first array:")
a=[]
b=[]
n=int(input())
print("Enter the {} elements of the array:".format(n))
for i in range(n):
    z=input()
    a.append(z)
a=list(map(int,a))
print("Enter the length of second array:")
m=int(input())
print("Enter the {} elements of the array:".format(m))
for j in range(m):
    y=input()
    b.append(y)
b=list(map(int,b))
challenge(a,b)

Вышеуказанная программа представляет собой простую программу на Python, которая принимает один массив и сравнивает элементы со вторым массивом. Когда я запускаю Программу, она показывает 'okc' undefined, даже если я ее определил. В чем проблема?

...