Define a python function as following
使用者: Dannyko 發佈日期 : 24-06-15 03:22 p.m.
  1. please check to ensure the valued to functions are integer.
  2. function name is Add
  3. pass 2 pramaters to the function
  4. add the value and return the values
回覆數 : 1 瀏覽數 :93
回覆: Dannyko 發佈日期 : 24-06-15 03:31 p.m.

def Add(a, b):

    try:

        a = int(a)

        b = int(b)

        sum = a + b

        return sum

except ValueError:

       return None

 

print(Add(2,3))

         

登入以回覆此論壇主題