python基础练习题:简单有趣#270:邪恶代码勋章【难度:1级】--景越Python编程实例训练营,不同难度Python习题,适合自学Python的新手进阶

python基础练习题:简单有趣#270:邪恶代码勋章【难度:1级】:

任务

EvilCode类似于Codewars游戏.你必须解决尽快编程任务.然而,不同于Codewars,EvilCode奖你一枚奖牌,这取决于你把解决任务的时间.

获得金牌,你的时间必须是(严格)不如对应勋章的时间.您可以在所有授予`“金”,"银"或"铜奖"奖章’,或’“无”'奖章.只有一个奖章(最好的实现)获得.

现在给你的任务,并对应于每个勋章时实现的时间.你的任务是返回颁发奖牌.

MM:SS每次在格式HH给出.

输入输出

[输入]``串userTime

用户实现的时间.

[输入]``串gold

相当于金牌的时间.

[输入]``串silver

对应银牌的时间.

[输入]``串bronze

对应铜牌的时间.

这是保证`金<银

编程目标:

def evil_code_medal(user_time, gold, silver, bronze):
    #your code here


测试样例:

Test.describe("Basic tests")
Test.assert_equals(evil_code_medal("00:30:00","00:15:00","00:45:00",),"Silver")
Test.assert_equals(evil_code_medal("01:15:00","00:15:00","00:45:00",),"None")
Test.assert_equals(evil_code_medal("00:00:01","00:00:10","00:01:40",),"Gold")
Test.assert_equals(evil_code_medal("00:10:01","00:00:10","00:01:40",),"Bronze")
Test.assert_equals(evil_code_medal("00:00:01","00:00:02","00:00:03",),"Gold")
Test.assert_equals(evil_code_medal("90:00:01","60:00:02","70:00:03",),"None")
Test.assert_equals(evil_code_medal("03:15:00","03:15:00","03:15:01",),"Silver")
Test.assert_equals(evil_code_medal("99:59:58","99:59:57","99:59:58",),"Bronze")
.((,,,),"Gold")
Test.assert_equals(evil_code_medal("61:01:40","64:19:53","79:30:02","95:24:48"),"Gold")


最佳答案(多种解法):

点击查看答案

更多关联题目:

交流讨论:

Python基础训练营景越Python基础训练营QQ群
在这里插入图片描述
欢迎各位同学加群讨论,一起学习,共同成长!

免责申明:

本博客所有编程题目及答案均收集自互联网,主要用于供网友学习参考,如有侵犯你的权益请联系管理员及时删除,谢谢
题目收集至https://www.codewars.com/
https://www.codewars.com/kata/simple-fun-number-270-evil-code-medal

你可能感兴趣的:(Python编程初级练习题)