[Swlug] Interesting variations

Rhys Sage rhys_sage at yahoo.com
Sat May 27 01:36:16 UTC 2023


I probably shouldn't be trying this after a 12 hour workday but...

I put a short bit of code into the Pi Pico in Python and get different results each time. This is very curious...

#test counter versus counting
import time
Min = 0
Max = 100
Tix = 0
tim1 = time.ticks_us()
for x in range(Min, Max):
  Tix += 1
tim2 = time.ticks_us()
print(tim2 - tim1)
print(Tix)

Actual output...
>>> %Run -c $EDITOR_CONTENT
1185
100
>>> %Run -c $EDITOR_CONTENT
1064
100
>>> %Run -c $EDITOR_CONTENT
1069
100
>>> %Run -c $EDITOR_CONTENT
1054
100
>>> %Run -c $EDITOR_CONTENT
1053
100
>>> %Run -c $EDITOR_CONTENT
1054
100

I would have expected the top value to be the same down the list. 

Rhys Sage



More information about the Swlug mailing list