Skip to content

Commit 9281670

Browse files
committed
Update
1 parent 304d88d commit 9281670

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.ipynb_checkpoints/Functions-checkpoint.ipynb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,48 @@
10741074
"\n",
10751075
"Argument given as a list/tuple is split across required variable. This is called scatter"
10761076
]
1077+
},
1078+
{
1079+
"cell_type": "code",
1080+
"execution_count": 2,
1081+
"metadata": {},
1082+
"outputs": [
1083+
{
1084+
"name": "stdin",
1085+
"output_type": "stream",
1086+
"text": [
1087+
" 10 23 30 40\n"
1088+
]
1089+
},
1090+
{
1091+
"name": "stdout",
1092+
"output_type": "stream",
1093+
"text": [
1094+
"10 (23, 30, 40)\n",
1095+
"103\n"
1096+
]
1097+
}
1098+
],
1099+
"source": [
1100+
"#Example\n",
1101+
"def add(a, *b): # Function Definition \n",
1102+
" print(a, b)\n",
1103+
" return a + sum(b) # returns the sum; sum is a built in function that returns sum of elements in an iterable\n",
1104+
"l = list(map(int, input().split()))\n",
1105+
"print(add(*l)) # Function Calling\n",
1106+
"\n",
1107+
"# Input: 10\n",
1108+
"# 23\n",
1109+
"# 30\n",
1110+
"# 40"
1111+
]
1112+
},
1113+
{
1114+
"cell_type": "code",
1115+
"execution_count": null,
1116+
"metadata": {},
1117+
"outputs": [],
1118+
"source": []
10771119
}
10781120
],
10791121
"metadata": {

Functions.ipynb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,48 @@
10741074
"\n",
10751075
"Argument given as a list/tuple is split across required variable. This is called scatter"
10761076
]
1077+
},
1078+
{
1079+
"cell_type": "code",
1080+
"execution_count": 2,
1081+
"metadata": {},
1082+
"outputs": [
1083+
{
1084+
"name": "stdin",
1085+
"output_type": "stream",
1086+
"text": [
1087+
" 10 23 30 40\n"
1088+
]
1089+
},
1090+
{
1091+
"name": "stdout",
1092+
"output_type": "stream",
1093+
"text": [
1094+
"10 (23, 30, 40)\n",
1095+
"103\n"
1096+
]
1097+
}
1098+
],
1099+
"source": [
1100+
"#Example\n",
1101+
"def add(a, *b): # Function Definition \n",
1102+
" print(a, b)\n",
1103+
" return a + sum(b) # returns the sum; sum is a built in function that returns sum of elements in an iterable\n",
1104+
"l = list(map(int, input().split()))\n",
1105+
"print(add(*l)) # Function Calling\n",
1106+
"\n",
1107+
"# Input: 10\n",
1108+
"# 23\n",
1109+
"# 30\n",
1110+
"# 40"
1111+
]
1112+
},
1113+
{
1114+
"cell_type": "code",
1115+
"execution_count": null,
1116+
"metadata": {},
1117+
"outputs": [],
1118+
"source": []
10771119
}
10781120
],
10791121
"metadata": {

0 commit comments

Comments
 (0)