[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Python Programming Tutorial – 17 – Flexible Number of Arguments
by
Tags:
Comments
35 responses to “Python Programming Tutorial – 17 – Flexible Number of Arguments”
-
tuna Rocks
-
I'm a vegetarian and I'm gonna ate tuna.
-
how could you stay till 3 am weird but seems like albert anstine
-
Can somebody explain to me this again! what are arguments in this context??? I know I sound really dumb sorry
-
If anyone of you is wondering, *args works fine even when different types of arguments are passed within the same function call. For example
def numbers (*args):
for arg in args:
print(arg)numbers(1, 2, 3) #case1
numbers("alpha", "beta", "gamma") #case2
numbers("one", 2, 3.0) #case3The output in this case is
#case1
1
2
3
#case2
alpha
beta
gamma
#case3
one
2
3.0 -
Why += but not only +
I am talking about this line
total += a
This is kinda confusing -
At 2:56 you used commas, but can't you use + signs, x signs, / signs etc.?
-
def sum(*args):
total = 0
for x in args:
total+=x
print (total)sum(10,20,30,40)
output :
10
30
60
100why I am getting kind of arithmetic progression. I just need to see total SUM !!
What's wrong ??!
-
isn't the print statement inside for loop?How to identify whether a statement is inside the loop?
-
Ok, so if you set 'for n in range' to 1001, with the 'magic number' value set to 256 (or less) the program works fine. As soon as you increase it to 257 (or more) it immediately fails. Why??
-
What's the matter is about the tuna? (-:
Awesome channel! -
what does += mean?
-
what is the code for taking input(of adding) from user instead of giving in the code itself
-
I noticed the numeric results change if you take the print statement, and line it up under 'total += a'. …really weird.
-
3 am tutorials… thank you so much 🙂
-
is args a list or what
-
I have a doubt that in the argument that is *args is a forming a array or a any data storing structure cause you going through that to access the value . so i am a kind of doubt is it a array or something else
-
def add_numbers(*args):
total=0
for a in args:
total += a
return totalsum=add_numbers(3,30)
print("result is",sum,) -
Videos are great, but it would be more helpful if you record video in presentation mode
-
I m not able to understand the logic of total like that, could you please explain me ?
-
Adding is the easy part, how do I do subtraction??
-
Great videos and much appreciated. Humor and perfect lengths. My kind of style Thx 🙂
-
dont u sleep dude? your system time shows 3:45 am????
"programmers wont sleep right" they just went offline 😛 -
Hi,
can you help me?
def avarage(*args):
dividend = 0
for a in args:
dividend += a
divisor = len(args)
answer = dividend/divisor
print(answer)
avarage(int(input))i am getting error… if i use avarage(10,20) , i get 15.
how can i add user input? -
watching this tutorial exactly at 3:40 AM !!!!:p
-
Why does my console go blank sometimes?
-
what does "+=" mean ?
-
+thenewboston hey bucky if i type in this code i could add the numbers but the numbers keep pooping in each time i add an anothe number for example if i want to add add 3 and 5 it would show me the output as 3 and 8 pls help me in this regard
def explaining_arguments(*args):
car = 0
for e in args:
car +=e
print(car)
explaining_arguments(3,5)output:3
8 -
what if you want to ask the user for what they want to add?
-
Tuna always RULES 😀
-
celsius to fahrenheit converter by using args
def cel_fahr(*cel):
for x in cel:
fahr=x*9/5+32
print(fahr) -
2:00 You have a giraffe in your house?
-
why are my results coming out like this?
('Bucky', 'ate', 'tuna')
('Sally', 'farts', 'gently')
('Bucky', 'is', 'awesome')anytime i try to pass the arguements that require me to use a variable, it ends up coming out like this?
besides that, great tutorials!
-
Nice python tutorials thanks a lot.
-
AM 3:49,you are so cool
Leave a Reply