defadd(num1, num2):
total = num1 + num2
print(total)
add(1,2)
List as arguments
InsteadΒ
ofΒ
givingΒ
multipleΒ
arguments,Β
weΒ
canΒ
passΒ
aΒ
list
Β
asΒ
aΒ
singleΒ
argumentΒ
thatΒ
holdsΒ
multiple
Β
values
.
TheΒ
listΒ
isΒ
thenΒ
accessedΒ
insideΒ
theΒ
functionΒ
viaΒ
indexing
.
deffunction_name(list_argument):
<function body>
my_list = [1,2]
defadd(list_num):
total = 0for i in list_num:
total = total + i
print(total)
add(my_list)
#my_list will be passed to list_num, and it will be used inside the function
*args
ByΒ
passingΒ
*args
Β
asΒ
anΒ
argumentΒ
toΒ
aΒ
function,Β
PythonΒ
allowsΒ
usΒ
toΒ
passΒ
any
Β
number
Β
ofΒ
arguments
Β
toΒ
aΒ
function,Β
andΒ
itΒ
willΒ
storeΒ
themΒ
inΒ
argsΒ
likeΒ
aΒ
List
.
deffunction_name(*args):
<function body>
defadd(*args):
total=0for i in args:
total = total + i
print(total)
add(1,2,3,4)
Sign In
You will receive an OTP for verification purposes.
Our Result
Sanatan is our in-house coding prodigy who ranked as a Top 2 finalist in Googleβs Code-In competition (now defunct). Heβs a great example of how starting early in your coding journey can be so empowering that you can even find yourself tackling challenges at tech giants like Google!
What the world says about Tekie
βWhile most competing platforms are teaching students block-based programming, Tekie is attempting to teach young students the fundamentals of text-based programming, which is to write actual coding language syntax.β
The founder elaborates, βWe came up with the idea of animation because that helps bring imagination to reality. We also wanted to make learning interesting and engaging.β
Parents trust us.
The best learning happens when you are not learning, you are playing and enjoying. For Medha, learning has been a pleasant glide, thanks to a warm and interpersonal method of teaching; it's like she is learning from a friend who knows her! She loves the puzzles and other methods used- both experimental and classic.