Ad
Fundamentals
Games
Code
Diff
  • def riddle(word): return word.index('?')
    • def riddle(word):
    • return len(word) - 1
    • def riddle(word): return word.index('?')
Fundamentals
Code
Diff
  • def numberprint(x):
        final = ''
        for i in range(1,x+1):
            final += str(i)
        for i in range(x-1,0,-1):
            final += str(i)
        return int(final)
    • def numberprint(x):
    • accending = list(range(1, x + 1))
    • descending = list(range(x-1, 0, -1))
    • newlist = accending + descending
    • strings = [str(integer) for integer in newlist]
    • a_string = "".join(strings)
    • an_integer = int(a_string)
    • return an_integer
    • final = ''
    • for i in range(1,x+1):
    • final += str(i)
    • for i in range(x-1,0,-1):
    • final += str(i)
    • return int(final)