+ 2
Optimizing my code to get the smallest divisor of int(n) using lambda
Is there a better way to get the smallest divisor preferably, WITHOUT using a function)? Specifically, I want to get rid of the print(z[0]) statement. Do I even have to create the list in the first place? Thanks! https://code.sololearn.com/cZYLeusGNB46/?ref=app
2 odpowiedzi
+ 4
x = int(input())
for i in range(2,x+1):
if(x%i==0):
print(i)
break
+ 1