【Python CheckiO 题解】I Love Python!


CheckiO 是面向初学者和高级程序员的编码游戏,使用 Python 和 JavaScript 解决棘手的挑战和有趣的任务,从而提高你的编码技能,本博客主要记录自己用 Python 在闯关时的做题思路和实现代码,同时也学习学习其他大神写的代码。

CheckiO 官网:https://checkio.org/

我的 CheckiO 主页:https://py.checkio.org/user/TRHX/

CheckiO 题解系列专栏:https://itrhx.blog.csdn.net/category_9536424.html

CheckiO 所有题解源代码:https://github.com/TRHX/Python-CheckiO-Exercise


题目描述

【I Love Python!】:练习函数的调用,定义一个函数,返回字符串“I Love Python!”

【链接】https://py.checkio.org/mission/i-love-python/

【输入】:Nothing

【输出】:字符串

【范例】

i_love_python() == "I love Python!"

代码实现

def i_love_python():
    """
        Let's explain why do we love Python.
    """
    return "I love Python!"


if __name__ == '__main__':
    # These "asserts" using only for self-checking and not necessary for auto-testing
    assert i_love_python() == "I love Python!"

大神解答

看看各个国家的语言

# Select your language in which you want to say "I Love Python!"
# By default it answers in english.
def i_love_python(language="English"):    
    if language == "Binary": return "01000010011001010010000001110011011101010111001001100101001000000111010001101111001000000110010001110010011010010110111001101011001000000111100101101111011101010111001000100000010011110111011001100001011011000111010001101001011011100110010100101110"
    if language == "Deutsch": return "Ich liebe Python!"
    if language == "English": return "I love Python!"
    if language == "Español": return "Me Encanta Python!"
    if language == "Espéranto": return "Αγαπώ Python!"
    if language == "Elf": return "Amin mela Python!"
    if language == "Ελληνική": return "Αγαπώ Python!"
    if language == "Français": return "J'aime Python !"
    if language == "Italiano": return"Adoro Python!"
    if language == "русский": return "Я люблю Python !"
    if language == "L337 Speak": return "1 L0\/3 p'/7|-|0|\|!"
    if language == "코리안": return "나는 파이썬 Python!"
    if language == "中國": return "我愛Python的 !"
    if language == "日本の": return "私はPythonのが大好き !"
    if language == "हिन्दी": return "मैं अजगर प्यार!"
发布了145 篇原创文章 · 获赞 511 · 访问量 45万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 数字20 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览