filmov
tv
#35 Python Tutorial for Beginners | Keyworded Variable Length Arguments in Python | **kwargs

Показать описание
Check out our courses:
Coupon: TELUSKO10 (10% Discount)
Coupon: TELUSKO10 (10% Discount)
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
For More Queries WhatsApp or Call on : +919008963671
In this lecture we will discussing Kwargs:
-- Keyword variable length argument
-- we have talk about variable length argument in previous chapter
Variable length argument :
-- A variable-length argument is a feature that allows a function to accept an arbitrary number of arguments.
The syntax for defining a variable-length argument in Python is to use an asterisk (*) before the parameter name.
e.g
def person(name,*data):
print(name)
print(data)
person('navin',28,9765432)
keyword variable length argument:
-- keyword variable length argument is a feature that allows a function to accept an arbitrary number of keyword arguments.
-- use a double asterisk (**) to define a variable-length argument that accepts keyword arguments. For example:
-- the **kwargs parameter allows the function to accept an arbitrary number of keyword arguments. The function can then loop over the dictionary of keyword arguments and do something with them.
e.g
def person(name,**data): #**kwargs
print(name)
for i, j in data:
print(i,j) #i is key and j is value
person('navin',aget=28,city='Mumbai',mob=9865432)
Python Tutorial to learn Python programming with examples
Editing Monitors :
Subscribe to our other channel:
Telusko Hindi :
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
Coupon: TELUSKO10 (10% Discount)
Coupon: TELUSKO10 (10% Discount)
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
For More Queries WhatsApp or Call on : +919008963671
In this lecture we will discussing Kwargs:
-- Keyword variable length argument
-- we have talk about variable length argument in previous chapter
Variable length argument :
-- A variable-length argument is a feature that allows a function to accept an arbitrary number of arguments.
The syntax for defining a variable-length argument in Python is to use an asterisk (*) before the parameter name.
e.g
def person(name,*data):
print(name)
print(data)
person('navin',28,9765432)
keyword variable length argument:
-- keyword variable length argument is a feature that allows a function to accept an arbitrary number of keyword arguments.
-- use a double asterisk (**) to define a variable-length argument that accepts keyword arguments. For example:
-- the **kwargs parameter allows the function to accept an arbitrary number of keyword arguments. The function can then loop over the dictionary of keyword arguments and do something with them.
e.g
def person(name,**data): #**kwargs
print(name)
for i, j in data:
print(i,j) #i is key and j is value
person('navin',aget=28,city='Mumbai',mob=9865432)
Python Tutorial to learn Python programming with examples
Editing Monitors :
Subscribe to our other channel:
Telusko Hindi :
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
Комментарии