TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Python Tutor: Visualize Code Execution

5 点作者 r4vik将近 12 年前

2 条评论

mjhea0将近 12 年前
<a href="http:&#x2F;&#x2F;www.pythontutor.com&#x2F;visualize.html#code=%23+Write+a+function,+power(),+that+takes+two+%0A%23+non-negative++integers,+base+and+exponent,+%0A%23+and+prints+the+base+raised+to+the+exponent+%0A%23+power.%0A%0A%23+Do+not+use+the+base+**+exponent+(2**4)+%0A%23+notation.%0A%0A%0Adef+power(base,+exponent)%3A%0A++++new_base+%3D+1%0A++++for+x+in+range(0,exponent)%3A%0A++++++++new_base+*%3D+base%0A++++print+new_base%0A%0Aprint+pow(3,10)+%3D%3D+59049&amp;mode=display&amp;cumulative=false&amp;heapPrimitives=false&amp;drawParentPointers=false&amp;textReferences=false&amp;showOnlyOutputs=false&amp;py=2&amp;curInstr=2" rel="nofollow">http:&#x2F;&#x2F;www.pythontutor.com&#x2F;visualize.html#code=%23+Write+a+f...</a>
duberton将近 12 年前
awesome work!