Skip to content

Instantly share code, notes, and snippets.

@River2056
Created September 16, 2020 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save River2056/a8180c94e7741112833ff11df61bba76 to your computer and use it in GitHub Desktop.
Save River2056/a8180c94e7741112833ff11df61bba76 to your computer and use it in GitHub Desktop.
def sum(*agrs):
result = 0
for nums in agrs:
result += nums
return result
print(sum(1, 2, 3, 4, 5)) # 輸出15
print(sum(2, 4)) # 輸出6
print(sum(5, 6, 7, 8, 9, 10)) # 輸出45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment