0
Line 15 has a syntax error, why is that??
The aim of this code is to identify the factors of the inputed number. factors = [] x = input() a = 0 while True : a = a + 1 if x % a == 0 : factors.append(a) #x = x / a continue if a == x ** (1/2) : break reduce(lambda x, y: x * y, factors) = b x / b = c factors.append(c) print ("The factors of the number is "factors".")
5 Antworten
+ 2
you should backscape the " around the word factor or use ' for the whole text
print ("The factors of the number is \"factors\".")
print ('The factors of the number is "factors".')
+ 2
You can assign the result of an expression to a variable and not vice versa:
b= reduce(...) and not reduce(...) = b
+ 1
line 6 looks OK, maybe there's something wrong with the values
0
Thank, that seemed to solve it but now the Line with lambda seem to be acting up. Got any thoughts??
And if you could explain it yhay would be great. Actaully i stolen it after searching for A way to multiply the integrera of a list. Eve wrote this but never explained it. Would you mind??
0
Thank you. That tip worked wonders. I also get a syntax error on line 6 with the equal sign. Do you see anything that is wrong with that??