The code you provided has a syntax error. The correct code should be:

def sum(arga, argb):
    total = arga + argb
    print('内为:', total)
    return total

total = sum(1, 2)
print("外为:", total)

This code defines a function called sum that takes two arguments arga and argb. It calculates the sum of these two arguments and stores it in the total variable. Then, it prints the value of total with the message "内为:". Finally, it returns the value of total.

Outside the function, the code calls the sum function with arguments 1 and 2, and stores the returned value in the total variable. Then, it prints the value of total with the message "外为:"

def sumargaargb total=arga+argb print内为total return totaltotal=sum12print外为total

原文地址: https://www.cveoy.top/t/topic/ioC4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录