appending an array in while loop and if condition

n = -12
while n < 15:
    if n < 0:
        dgt = []
        dgt.append(n)
    n = n+1
print(dgt)

I am trying to append all negative values in dgt[] but what I get from this code [-1] which is not my result I want all negative valuse in dgt[] please help me.



from Recent Questions - Stack Overflow https://ift.tt/3xlZCRT
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept