首页 > 其他 > 详细

Code Combat学习心得(Kithgard地牢45关Mightier Than the Sword)

时间:2018-03-04 12:19:17      阅读:200      评论:0      收藏:0      [点我收藏+]

代码来自(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)

Code Combat学习心得(Kithgard地牢45关Mightier Than the Sword)

原文:https://www.cnblogs.com/hzez/p/8504273.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!