Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help to find a command
#1
Hi everyone,
I am new in coding and struggling to to find a way for the following.
Can someone help me with some commands (I will study it in details then) to help me if this case.

I have have a list like this
a = [[10, 20], [30, 60], [[50, 200]]

I will create a variable (b) which will increase from ZERO until the smallest value of a[x][1].. When this variable reaches it, then I will a.append(0) or if it increase 100 times and do not reach any number, then the program stops

For example
b = 1
is b > 20 i.e a[0][1] NO
is b > 40 NO
is b > 60 NO
then
b = 2
..
b = 21
is b > 20 YES
then
a = [[10, 20, 0], [30, 40], [[50, 60]]

I am trying this:
a = [[10, 20], [30, 40], [50, 60]]
z = 0
b = 0
while z < 100:
if b > a[z][1]:
a[z].append(0)
z = 0
z += 1
b += 1
print (a)

The real case is one sample with many defects, I will test it by increasing the stress until one defect fail, at the end I will now how many defect failed by looking which one has the ZERO at the end.

Thank you!
Reply


Messages In This Thread
Help to find a command - by andre_fermart - Feb-02-2019, 08:06 AM
RE: Help to find a command - by stullis - Feb-02-2019, 04:15 PM
RE: Help to find a command - by perfringo - Feb-02-2019, 11:47 PM
RE: Help to find a command - by perfringo - Feb-03-2019, 12:51 PM
RE: Help to find a command - by andre_fermart - Feb-04-2019, 08:01 AM
RE: Help to find a command - by perfringo - Feb-04-2019, 09:49 AM
RE: Help to find a command - by andre_fermart - Feb-05-2019, 05:47 AM
RE: Help to find a command - by perfringo - Feb-05-2019, 09:01 AM
RE: Help to find a command - by perfringo - Feb-05-2019, 12:15 PM
RE: Help to find a command - by andre_fermart - Feb-12-2019, 02:34 AM

Forum Jump:

User Panel Messages

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