Holding until next value change

Arshpreet Singh arsh840 at gmail.com
Thu Aug 25 07:30:47 EDT 2016


On Saturday, 20 August 2016 19:48:38 UTC+5:30, andrze... at gmail.com  wrote:
 
> prev = None
> for value in main_call():
>     if value==prev:
>         pass
>     else:
>         prev = value
>         if prev>0:
>             print('+v')
>         elif prev<0:
>             print('-v')
>         else:
>             print('0')

No it did'nt worked.



More information about the Python-list mailing list