Python Forum
HELP - Returning the first self number superior or equal to my argument
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HELP - Returning the first self number superior or equal to my argument
#1
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 :

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.
Reply


Messages In This Thread
HELP - Returning the first self number superior or equal to my argument - by Kokuzuma - Nov-01-2018, 06:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  HELP - Returning self numbers lower or equal to my argument Kokuzuma 4 2,798 Nov-01-2018, 06:35 PM
Last Post: Kokuzuma
  Divide a number - Multiple levels - Sum of all numbers equal to input number pythoneer 17 8,981 Apr-20-2018, 04:07 AM
Last Post: pythoneer

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020