Is there a method to count time without imports?

℡╲_俬逩灬. 提交于 2019-12-11 06:58:21

问题


I've got a CASIO fx-CG50 with python running extended version of micropython 1.9.4

Decided to make a game but I really need a sleep function, I cannot use any imports as everything is pretty barebones. Any help would be greatly appreciated.

I've tried downloading utilities but they're just extra applications, nothing seems to really exist for the casio.

Cheers!


回答1:


If you cannot import time (or utime) in your code, you could always implement a simple function that loops for a certain number of steps:

def wait(step): 
    for i in range(step):
        pass 

wait(999999)

In that case, the actual time spent in the function will depend on the computational power of your device.



来源:https://stackoverflow.com/questions/58007418/is-there-a-method-to-count-time-without-imports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!