| 123456789101112131415161718192021222324252627 |
- """
- example05 - 函数,
- author: tanlie
- date: 2026/8/22
- """
- def test(x: int, y: int) -> int:
- print("test()函数被调用了")
- return x + y
- test(1, 2)
- # test("a", 1) # 这里会报错,因为字符串和整数不能相加
- def test2(x: int, y: int) -> tuple:
- return x, y
- print(type(test(1, 2)))
- print(type(test2(1, 2)))
- a, b = test2(1, 2)
- print("a, b ->", a, b)
|