From b80c7c66a68f60636027707581579dc46ba68761 Mon Sep 17 00:00:00 2001 From: zcj Date: Sat, 21 Mar 2026 15:35:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=B0=E5=AD=97=E6=AF=94?= =?UTF-8?q?=E8=BE=83=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test1.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test1.py diff --git a/test1.py b/test1.py new file mode 100644 index 0000000..3bd66c3 --- /dev/null +++ b/test1.py @@ -0,0 +1,25 @@ +def compare_numbers(a, b): + """ + 比较两个数字的大小并返回结果 + + 参数: + a: 第一个数字 + b: 第二个数字 + + 返回: + str: 比较结果字符串 + """ + if a > b: + return f"{a} 大于 {b}" + elif a < b: + return f"{a} 小于 {b}" + else: + return f"{a} 等于 {b}" + + +# 测试代码 +if __name__ == "__main__": + # 测试用例 + print(compare_numbers(5, 3)) + print(compare_numbers(2, 7)) + print(compare_numbers(4, 4)) \ No newline at end of file