I just finished another assignment and I can't figure out why this none keeps appearing after you enter a language:

while True:
    print"Hello, how are you?"
    language=raw_input("Pick a language: french, german, hungarian, dutch: ")
    if"french"in language:
        def function():
            print"Bonjour, comment allez-vous?"

    elif"german"in language:
        def function():
            print"Hallo, wie geht es Ihnen?"

    elif"hungarian"in language:
        def function():
            print"Szia, hogy vagy?"

    elif"dutch"in language:
        def function():
            print"Hello, hoe zijn u?"

    # main
    print function()

use function() only instead of print function() because your function returns None and which is printed later. I wonder dose your program actually working?! It looks like cause an infinite loop to me. Use a break statement below each of the print statements but indenting them to the def keyword to come out of the while loop.

Oh no, it's supposed to be an infinite loop. And I knew I forgot something. The return thing after the functions. Thanks!

I am not sure why you make it so complicated. Anybody with a basic knowledge of Python would code it this way:

while True:
    print "Hello, how are you?"
    language=raw_input("Pick a language: french, german, hungarian, dutch: ")
    if language == "french":
        print"Bonjour, comment allez-vous?"

    elif language == "german":
        print"Hallo, wie geht es Ihnen?"

    elif language == "hungarian":
        print"Szia, hogy vagy?"

    elif language == "dutch":
        print"Hello, hoe zijn u?"
    
    else:
        break

Oh well actually I had to use functions to do this lesson, otherwise I would fail.

elif"dutch"in language:
        def function():
            print"Hello, hoe zijn u?"

"Hello, hoe zijn u?" ?! Looks like someone used a babelfish translater :)
Change it to : "Hallo, hoe gaat het met u?" (trust me, I'm Dutch)

Oh well actually I had to use functions to do this lesson, otherwise I would fail.

In this case, interesting approach! You won't see functions written within an if statement very often.

Oh well actually I had to use functions to do this lesson, otherwise I would fail.

Could you have done it this way??

def my_function( language ):
    if "french" in language:
        return "Bonjour, comment allez-vous?"
    elif "german" in language:
        return "Hallo, wie geht es Ihnen?"
    elif "hungarian" in language:
        return "Szia, hogy vagy?"
    elif "dutch" in language:
        return "Hello, hoe zijn u?"
    else:
        return "Invalid language entered"

    # main
while True:
    print"Hello, how are you?"
    language=raw_input("Pick a language: french, german, hungarian, dutch: ")
    print my_function( language.lower() )
This question has already been answered. Start a new discussion instead.