代码来自(Kithgard地牢45关Mightier Than the Sword)
# A variable is a way of holding on to a value.
#变量是一种保存值的方式。
# Here the "password" variable holds the secret phrase we need.#这里“password”变量保存我们需要的密码。
#定义密码为‘Secret Message‘
password = ‘Secret Message‘
hero.moveUp()
hero.moveRight()
hero.say(password) #说出变量“password”中包涵的值‘Secret Message‘
# A variable changes its value whenever you assign it.
#每当您给变量赋予新的值时,变量都会换为新的值。
#给变量”password“赋予新的值“‘So Many Doors‘
password = ‘So Many Doors‘
hero.moveRight()
# Change the string in this line to the password variable.
# 在“说“变量时候不要加引号,直接输入变量名称。此处说的密码就是新的值”So Many Doors”
hero.say(password)
hero.moveRight()
password = ‘Let Me Out Of Here‘
# Move to the last door and say the password variable to open it.
#移动到最后一扇门并说出新密码变量‘Let Me Out Of Here‘以打开它。
hero.say(password)