def sum_of_two_numbers(a: int, b: int) -> int:
return a + b
def sum_of_two_numbers(a: int, b: int) -> int:
return a + b
sum_of_two_numbers("hello", "world")
example.py:4: error: Argument 1 to "sum_of_two_numbers" has incompatible type "str"; expected "int"
example.py:4: error: Argument 2 to "sum_of_two_numbers" has incompatible type "str"; expected "int"
def concatenate_strings(str_1: str, str_2: str) -> str:
return str_1 + str_2
from typing import TypeVar, List
T = TypeVar('T')
def first_element(lst: List[T]) -> T:
return lst[0]
标签: 电商