2021年3月19日

时间:1个小时左右

代码:200行左右

博客:1

知识点:Python的函数操作

def say_hello():
    print("hello")


# 定义一个求和函数
def sum(a, b):
    """
    :param a: 整数a
    :param b: 整数b
    :return: 两个整数的和
    """
    result = a + b

    return result


# 定义一个列表
list1 = [12, 34]
dict_1 = dict(age=19, name="张三")


def get_info():
    return list1, dict_1


if __name__ == "__main__":
    say_hello()
    print(sum(3, 8))
    # list_info = get_info()[0]
    # print(list_info)
    # dict_info = get_info()[1]
    # print(dict_info)
    list_info, dict_info = get_info()
    print(list_info)
    print(dict_info)
原文地址:https://www.cnblogs.com/j-y-s/p/14903179.html