Code not working

Hi, This really isn’t about codecombat so this is why it is in the #off-topic section.

def numberToLetter(number):
    letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    letters = letter.split()
    if number > 25:
        return False
    return letters[number]

Number1 = numberToLetter(5)
print(letter)

Why would this code not work?

@Speedypickle1, I’m pretty sure this is happening because of this:

I think that the issue is that letter is not defined. Another issue is this part in your function:

Even if your number is greater than 25, it will return false, but then it will immediately return true no matter what. I think what you were trying to do is this:

if number > 25:
      return False
else:
      return letters[number]

I think that these are the issues with your code, but let me know if it’s something else. Hope this helps!
Grzmot

Let Me try that @Grzmot

It still will not work. I think there is something else that is wrong

@Speedypickle1, if you want it to print, I think that you need to change that to:

print(letters)

You need this because your function returns letters, not letter. Another issue is that i’m pretty sure you never call your function, you just assign it to Number1. Hope this helps!
Grzmot