Python Tutorial for Beginners 14 - Default parameters and Multiple Arguments in Python

preview_player
Показать описание
In this Python Tutorial for Beginners video I am going to show How to use Default Arguments, *args and **kwargs (Variable-length Arguments) in Python. Wo what are Default Values for Arguments ? Python allows as to provide default values for a function’s arguments. These arguments are optional when the function is called.Passing lists as arguments def sum(*args): - Lists can be passed in cases where there may be a variable number of arguments
Passing dictionaries to functions (def functionName(**kwargs)).

★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!

python function multiple parameters
python return multiple values
python lambda multiple arguments
python optparse multiple values
python dictionary multiple values
python returning multiple values
Verwandte Suchanfragen zu python functions
python functions def
python classes
python round float
python return array
python function parameter
python if integer
python boolean
python tutorial
Рекомендации по теме
Комментарии
Автор

Man you are very very good explainer, in fact the best I have seen on youtube explaining Python. Thank you very much

kamaaladiin
Автор

I am watching your tutorial from the beginning and really you explain each topic very clearly from for such videos.

garvit
Автор

Because of YOU, I am able to learn Python... You are my Guru!!!

shrinivaspandhare
Автор

def main():
x = "happy"
y = "pumpkin"
z = "orange"
pumpkin = "sleepy"
happy = "vampire"


orange(y, x, z)
orange(x, z, y)
orange(pumpkin, z, "y")
z = "green"
orange("x", "pumpkin", z)
orange(y, z, happy)

def orange(z, y, x):
print(y + "and" + z + "were" + x)

main()


this question on hw is asking me what would be the 5 outputs for that and i cant seeem to figure out

Kamahley
Автор

I'm also doing python in my university
but you #the man really best

AliHaider-hglj
Автор

I think in 3.4.2. you don't have to specify the default value when calling a function (per your video @ 3:50)

def studentscore ():
    name = input("Enter Name of the student:")
    score = float(input("Enter score:"))
    print ("Name:", name, ", ", "Score:", score)

saum
Автор

I have 2 questions, 1.) How to pass a single argument thru variables in case I am reading them from user? particularly 2nd argument onward. will it be something like - strudentScore (, y):
2.) how to set default values in case of multiple parameters. Will it be something like - strudentScore( name = "tom", *score= 0):

TheSD
Автор

This video tutorial is awesome with best explanation ever on YouTube for beginners. I am about to complete this video. If one can suggest videos on how to plot graphs by Python would be great :)

surbhisinha
Автор

You have some deficiencies in English but you explain things well.

stanislavdimitrov
Автор

can you have multiple multiple arguments? because how does the function know, which values belong to which parameter, when you only divide them by the use of a comma
?

jellejanwillie
Автор

suppose function contains 2 or more arguments of same datatype, then. while calling that func how it would come to know which parameters to be given to which variable?

jay_rana
Автор

I have a doubt while explaining you said about multiple parameter right while output it shows curly braces we cant remove it or it is necessary? please explain this doubt

commentery
Автор

hi, i've a confusion what if we wanted more than one string in this likewise diff students score diff marks accordingly.

srishtiasija
Автор

Can u do the coding for the same output in python file.... Not in shell

shaifaliverma
Автор

Why we use " only for name and not for score?

sakchhichoudhary
Автор

def defaultParameter1(*name, *rollno):
print(name, rollno)
defaultParameter1("Student1", "student 2 ", 58, 59)

why i got an error

InDublin.
Автор

If I am using *parameter and I want a default value, how to define that in the function argument. Eg: def score(name="Tom", *score=0), this is giving syntax error

prianckachatz
Автор

what if I want to print subject name and followed by marks. (For eg. maths=90)
and even how to give multiple inputs (For eg. like in C, scanf("%d%d", &x, &y); )

harikachagantivlogs
Автор

When you initialize from tom to mark is it only temporary? bcoz in the following example where you initialize from 0 to 99 and execute it, it prints out tom again.

chicorebello
Автор

using the asterik, i"m not liable to set default values... what to do?

chitralalawat
welcome to shbcf.ru