add test.py with multiply function
This commit is contained in:
25
test.py
Normal file
25
test.py
Normal file
@@ -0,0 +1,25 @@
|
||||
def multiply(a, b):
|
||||
"""
|
||||
计算两个数字的乘积
|
||||
|
||||
参数:
|
||||
a (int/float): 第一个数字
|
||||
b (int/float): 第二个数字
|
||||
|
||||
返回:
|
||||
int/float: a和b的乘积
|
||||
"""
|
||||
return a * b
|
||||
|
||||
# 示例使用
|
||||
if __name__ == "__main__":
|
||||
# 测试函数
|
||||
result = multiply(5, 3)
|
||||
print(f"5 * 3 = {result}")
|
||||
|
||||
# 更多测试
|
||||
result2 = multiply(2.5, 4)
|
||||
print(f"2.5 * 4 = {result2}")
|
||||
|
||||
result3 = multiply(-2, 3)
|
||||
print(f"-2 * 3 = {result3}")
|
||||
Reference in New Issue
Block a user