We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 330bd39 commit 2300756Copy full SHA for 2300756
1 file changed
variable_args.py
@@ -0,0 +1,9 @@
1
+# *args- or variable-length arguments allow you to pass a variable number of arguments to a function.
2
+def sum(*args):
3
+ total = 0
4
+ for num in args:
5
+ total += num
6
+ return total
7
+
8
+result = sum(1,8, 2, 3, 15, 4, 5)
9
+print(f"The sum of the numbers is: {result}")
0 commit comments