Step by Step explanation of this code [closed]

徘徊边缘 提交于 2019-11-28 14:53:38
def mystery(n):  # define a function named "mystery", that takes one argument called "n"
    a, b = 0, 1  # make a variable named "a" and set it to 0; make a variable named "b" and set it to 1
    while a < n:  # as long as "a" is smaller than "n"
       print (a)  # display the value contained in "a" on the screen
       a, b = b, a + b  # set "b" to the sum of "a" and "b"; set "a" to the old value of "b" (before it was set to the sum of "a" and "b")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!