Need Help with a Python Math Program

Discussion in 'Programming' started by Ratman2050, Sep 21, 2011.

  1. #1
    Hi,

    I'm working on this Python program and it's starting to frustrate me a bit. The goal of the program is to print out Latin Squares. This is what I want it to do:

    pthon.jpg

    So far I have this:

    order_square = raw_input('What is the order of the square:')
    top_left = raw_input ('What is the top left number:')
    
    order_int = int(order_square)
    top_int = int(top_left)
    
    if order_int != 0:
        while range (0, order_int+1):
            row = top_int
            row2 = top_int+1
            print row, row2
    
    Code (markup):
    What my code does is do the row and row2 function and then loops it. When I put in 8 and 1 for the first two questions the result is 1 2 in constant loop.

    What I need printed out is 1 2 3 4 5 6 7 8 and then 2 3 4 5 6 7 8 1 and so on so forth.

    I think my while function loop is messed up because I want row2 to keep adding but it only adds once and repeats the print row, row2 again and again..

    Keep in mind this is my FIRST time programming...Any help is appreciated! thanks
     
    Ratman2050, Sep 21, 2011 IP