I just started learning python and was writing programs in Python GUI Shell IDLE. The code is the following:
>>> def buildConnectionString(params):
    """Build a connection string from a dictionary of parameters.
    Returns string. """
    return ";".join(["%s=%s" % (k,v) for k,v in params.items()])
    if __name__ == "__main__":
        myParams = {"server":"mpligrim",\
                "database":"master",\
                "uid":"sa",\
                "pwd":"secret"
                }
        print(buildConnectionString(myParams))
I am facing a problem while I I try to run this program. In IDLE, when I click on Run Module,  a new windows opens up saying "Invalid Syntax"
Here's the screenshot:

I am not able to find how to run this and would appreciate the help in proceeding further with this.
 
     
    