zoukankan      html  css  js  c++  java
  • 【网易官方】极客战记(codecombat)攻略-森林-似曾相识的味道deja-brew

    用字符串 (string) 唱歌!

    简介

    你可以连接(组合)字符串与其他字符串或数字:

    numberOfPotions = 5
    hero.say("I have " + numberOfPotions + " potions.")

    使用字符串连接与您的朋友一起唱歌!

    默认代码

    # 你可以把字符串连起来,或者把数字连接到字符串中。
    # 一起唱歌,使用字符串连接:
    # X potions of health on the wall!
    # X potions of health!
    # Take Y down, pass it around!
    # X-Y potions of health on the wall.
    potionsOnTheWall = 10
    numToTakeDown = 1
    while True:
        hero.say(potionsOnTheWall + " potions of health on the wall!")
        # 唱出下一句:

     

        # 唱出下一句:

     

        potionsOnTheWall -= numToTakeDown
        # 唱出最后一句:

    概览

    你可以 连接 (concatenate,combine) 几个字符串或者数字:

    numberOfPotions = 5
    hero.say("I have " + numberOfPotions + " potions.")

    使用字符串连接方法和你的朋友大声唱!

    英文歌词在下面:

    potionsOnTheWall + " potions of health on the wall!"
    potionsOnTheWall + " potions of health!"
    "Take " + numToTakeDown + " down, pass it around!"
    potionsOnTheWall + " potions of health on the wall."

    似曾相识的味道 解法

    # 你可以把字符串连起来,或者把数字连接到字符串中。
    # 一起唱歌,使用字符串连接:
    # X potions of health on the wall!
    # X potions of health!
    # Take Y down, pass it around!
    # X-Y potions of health on the wall.
    potionsOnTheWall = 10
    numToTakeDown = 1
    while True:
        hero.say(potionsOnTheWall + " potions of health on the wall!")
        # 唱出下一句:
        hero.say(potionsOnTheWall + " potions of health!")
        # 唱出下一句:
        hero.say("Take " + numToTakeDown + " down, pass it around!")
        potionsOnTheWall -= numToTakeDown
        # 唱出最后一句:
        hero.say(potionsOnTheWall + " potions of health on the wall.")
     
     
     
  • 相关阅读:
    OAF[1]开发环境的配置
    XAF如何开始学习XAF
    XPO开发指南简要
    XAF 如何使用AlertControl?
    企业邮箱及邮件服务器架设
    Excel的SUM函数9种公式设置
    XAF 如何显示非持久类数据列表
    分上下半月统计 SQL
    XAF中实现类型转换(ValueConverter)
    在XAF中如何自定义用户、角色、权限、资源、事件(复杂权限)
  • 原文地址:https://www.cnblogs.com/codecombat/p/12297890.html
Copyright © 2011-2022 走看看