Nov-01-2018, 06:43 PM
Hello,
I am a student and a beginner in learning python coding, and I'm stuck on a self-numbers exercise, where I'm asked to return, from the NextAuto(n) function, the first self-number superior or equal to n with n belonging to N*.
But I don't really know how to do it, I tried something but it doesn't work :
Thank you in advance.
I am a student and a beginner in learning python coding, and I'm stuck on a self-numbers exercise, where I'm asked to return, from the NextAuto(n) function, the first self-number superior or equal to n with n belonging to N*.
But I don't really know how to do it, I tried something but it doesn't work :
def NextAuto(n) : atnb=[] x=0 x>=n while x : atnb.append(x) for x in atnb : sommex=0 for s in (list(int(c) for c in str(x))) : sommex+=s if n==(x+sommex) in atnb : atnb.remove(n) return(atnb[0])Could you please help me by showing me an example about returning the first special item superior or equal to an argument, with even numbers for example, or simply by showing me clues on this specific case to find the answer ?
Thank you in advance.