Title: [Python] multiplication_commutative_test Author: waterapple Pastebin link: http://pastebin.com/0k3J00X7 First Edit: Thursday 11th of July 2013 02:11:17 AM CDT Last Edit: Thursday 11th of July 2013 02:11:17 AM CDT #------------------------------------------------------------------------------- # Name:        multiplication_commutative_test # Purpose:      Prove that any order of multiplying the same vales results #               in the same answer # # Author:      new # # Created:     11/07/2013 # Copyright:   (c) new 2013 # Licence:     #------------------------------------------------------------------------------- #!/usr/bin/env python     def test_multiplication_commutative(start_int,stop_int):     for int_one in xrange(start_int,stop_int):         for int_two in xrange(start_int,stop_int):             for int_three in xrange(start_int,stop_int):                 print "testing :", int_one, int_two, int_three,                 all_same = (                 (int_one * int_two * int_three) == # 123                 (int_one * int_three * int_two) == # 132                 (int_two * int_one * int_three) == # 213                 (int_two * int_three * int_one) == # 231                 (int_three * int_two * int_one) == # 312                 (int_three * int_one * int_two)    # 321                 )                 print all_same                 assert(all_same)     def main():     test_multiplication_commutative(1,1000)   if __name__ == '__main__':     main()