【转载】网易极客战记官方攻略-地牢-循环又循环

关卡链接:

https://codecombat.163.com/play/level/loop-da-loop编程

循环真是救命恩人!oop

简介:

你只须要 一个 while true循环 加上 4 条语句 就能够通关!code

仔细检查你的缩进!blog

默认代码

# 在 while true 里的代码会永远重复!
while True:
    # 右走
    hero.moveRight()
    # 向上走
    # 左走
    # 向下走

概览

你能够只用一个 while true 循环 以及 4 行命令 就能够存活下来!get

确保你加上的代码放在 while true 循环 的 里面。好好检查一下缩进!io

循环又循环 解法

# 在 while true 里的代码会永远重复!
while True:
    # 右走
    hero.moveRight()
    # 向上走
    hero.moveUp()
    # 左走
    hero.moveLeft()
    # 向下走
    hero.moveDown()

 

相关文章
相关标签/搜索