Topic: 'return' in function working in idle but not when run from source file

Hey, I have this function(for a hangman game) which takes the users input of a word, then converts that to a list. I use the len function to find the number of letters in that list, set it to a variable, then try and call that value in a formatted string. In idle, it returns the correct value, but from a source file no value is returned. Anybody know why and how to change that?

Code:

theletters=[]

def filler():

Thumbs up

Re: 'return' in function working in idle but not when run from source file

Here's the code :



theletters=[]

def filler():
    """Takes the input word and converts it to the list called 'theletters'."""
    theword=raw_input("Please enter a word to begin: ")
    x=list(theword)
    theletters.extend(x)
    y=len(theletters)
    return "%d letters." %(y)

Thumbs up

Re: 'return' in function working in idle but not when run from source file

Yeah I could just use print...[FacePalm].

Thumbs up