Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python for next loop
#1
I am new to python and trying to code for the below logic but not sure how to do it using for next loop

Colum1 Colum2 col 3 Col4
1234 111 Str1 50
1234 112 Str2 -50
5677 113 Str3 110
6789 114 Str1 50
6789 114 Str2 -30
6789 114 Str3 10
1456 115 Str1 -100
1456 115 Str2 50
1456 115 Str3 40
1456 115 Str4 -10

Str1 is considered as higher and goes lower based on sequence str2, str3, str4

If the col4 is negstive it can offset where the negative number has the same or lower Str relative to the positive value

like say for col 2 - 114 and col 1 = 6789 -
If Str1 is positive then it can offset with Str 2, Str 3 or Str 4 so the revised value should be 30 for Col 1 = 6789 and Col 2= 114

Say for Col 2 = 115
Str 1 is negative but it cannot offset with Str 2 or St3 or Str 4 but Str4 can offset its negative with any other Str 2 or Str3
So there is two values for Col2 = 115 and can be separated in two columns based on sign.
a) -100
b) 80

I am not sure how to write this sequence for loop in python.

Any help would be highly appreciated.
Reply


Messages In This Thread
Python for next loop - by sow2010 - Sep-24-2020, 03:13 AM
RE: Python for next loop - by perfringo - Sep-24-2020, 08:30 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020