python函数(未完成)

函数格式
def name(args):
    something...
    返回值 

def add(a, b):
    c = a + b
    return c

result = add(1, 2)
print(result)

def capitalaze(data):
    index = 0
    temp = ''
    for item in data:
        if index == 0:
            temp = item.upper()
        else:
            temp += item
        index += 1
    return temp


result = capitalaze('hello xiao')
print(result)

你可能感兴趣的:(python,python)