Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Location
    Ireland
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple Looping HELP

    I am having a problem with a simple loop,but I cant seem to get it to work.Basically I have a function Currentcalculator taking in a number of predefined parameters plus changing parameters for V and T from an excel spreadsheet.The spreadsheet is in the format shown.
    Temperature
    Wind 1 2 3 4 5
    1
    2
    3
    4
    I want to take a wind speed of 1,2,3,4 and temp of 1 and print the results to excel, then take wind speed of 1,2,3,4 and temp of 2,then a temp of 3,4 etc.Can anyone help me?here is my code

    x1 = win32com.client.Dispatch('Excel.Application')
    x1.Visible = 1
    x1Wb = x1.Workbooks.Open('current calc.xlsx')
    point = x1.Cells

    row, col = 0, 0
    V = ()
    T = ()

    i = 3
    j = 3
    k = 2
    while i < 28:
    while k < 8:

    cells = point(i,1)
    Wind = int(cells.Value)
    V = Wind

    cells = point(2,k)
    Temp = cells.Value
    T = Temp

    dlr = Currentcalculator(T,80,V,45,0.00403,0.01813,0.5,0.5,0.000123,0.000183,75,20,900,100)

    cells = point(j,k)
    cells.Value = dlr
    cells = point(j,k)
    if i<28:

    i = i+1
    j = j+1
    ## if k < 6:
    break

    k = k+1

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Location
    Brasília, Brazil
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Use the code tag to format your code. Otherwise it is very difficult to read Python code.

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Kakao View Post
    Use the code tag to format your code. Otherwise it is very difficult to read Python code.
    difficult? this is a nice substitute for impossible,

    for op: left justification make impossible to see where each while loops, if's are ended. as Kakao said, use code tags please.

    best regards


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •