# -*- coding: utf-8 -*- from libmicrocontest2_python27 import * if not check_version(): print "Warning: the version of the libmicrocontest2 is not the last one." print "Current version :\t" + get_currentversion() print "This program may not work properly. Consider downloading the latest version on\nthis page : http://www.microcontest.com/download.php\n" cont = commence_contest(1, "Your nickname", "Your password") # short form uses username, password from credentials.py # cont = commence_contest(1) a = int(cont.get_param("a", int)) # you can also use get_int, get_float, get_str b = cont.get_int("b") # or use it that way (it tries to return the right type automagically) # s = cont.a + cont.b s = a + b # then append the answer cont.append_answer("s", s) # then submit the answer and print result print(cont.submit_answer()) #or pass tuples directly to submit_answer (here using the short version) #print cont.submit_answer([("s", cont.a + cont.b)])