Forums

can someone please tell me why python does nothing when i run this program

Heres the program.

def print_two (*args): arg1, arg2 = args print "arg1: %s, arg2: %s" % (arg1, arg2)

def print_two_again (arg1, arg2): print "arg1: %s, arg2: %s" % (arg1, arg2)

def print_one (arg1): print "arg1: %s" % (arg1)

def print_none (): print "i got nothing"

print_two = ("First", "Second") print_two_again = ("First", "Second") print_one = ("First") print_none = ()

I dont get an error or anything just blank. Ive tried running through bash, and running the file directly via the files tab of the web page.

Any info is greatly appreciated.

Edit: youll have to assume i did all the indentations correctly. The way i typed it into the forum and the way its displayed are quite different.

Ah ha!

You are trying print_two = ("First", "Second")

But that is assigning ("First", "Second") to the name print_two

You actually want to run the function, so lose the '='. I.e.

print_two("First", "Second")

Gah, and i looked through it so many times. Thanks.

@Seraphist - I've made the same error a few times myself :-)

For reference, if you want your code samples to look good, you need to indent them by 4 spaces, and you can prefix them with :::python (also indented) to get nice syntax-highlighting too.

It's just markdown. cf the instructions right next to the "add" button...