Тёмный

Python *ARGS & **KWARGS are awesome! 📦 

Bro Code
Подписаться 2 млн
Просмотров 76 тыс.
50% 1

Опубликовано:

 

20 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 108   
@BroCodez
@BroCodez Год назад
# ----- *ARGS Example 1 ----- def add(*nums): total = 0 for num in nums: total += num return total print(add(1, 2, 3, 4)) # ----- *ARGS Example 2 ----- def display_name(*args): print(f"Hello", end=" ") for arg in args: print(arg, end=" ") display_name("Dr.", "Spongebob", "Harold", "Squarepants", "III") # ----- **KWARGS ----- def print_address(**kwargs): for value in kwargs.values(): print(value, end=" ") print_address(street="123 Fake St.", pobox="P.O Box 777", city="Detroit", state="MI", zip="54321") # ----- EXERCISE ----- def shipping_label(*args, **kwargs): for arg in args: print(arg, end=" ") print() if "apt" in kwargs: print(f"{kwargs.get('street')} {kwargs.get('apt')}") elif "pobox" in kwargs: print(f"{kwargs.get('street')}") print(f"{kwargs.get('pobox')}") else: print(f"{kwargs.get('street')}") print(f"{kwargs.get('city')}, {kwargs.get('state')} {kwargs.get('zip')}") shipping_label("Dr.", "Spongebob", "Squarepants", street="123 Fake St.", pobox="PO box #1001", city="Detroit", state="MI", zip="54321")
@simeonehdhdyxhxy
@simeonehdhdyxhxy Год назад
yesirr
@gamePlays9699
@gamePlays9699 Год назад
def add(*args): return type(args) print(add())
@Synceditxboxoffice
@Synceditxboxoffice Год назад
brother if you are ethical hacker try to start a series of writing own scripts for CTF
@user-nw5km7is9t
@user-nw5km7is9t 10 месяцев назад
for the chairty statement.
@gavinjoes.j5830
@gavinjoes.j5830 9 месяцев назад
Thank you bro 😊
@photoshopdepth
@photoshopdepth Год назад
It's actually insane how effective you are in teaching these concept.. you're in another league dude. Please keep these coming.
@0e0
@0e0 8 месяцев назад
truly great
@zabehullahalizadeh2310
@zabehullahalizadeh2310 Год назад
Bro please don't stop the playlist of python. Every one of your python videos worth millions.
@nonoobott8602
@nonoobott8602 Год назад
By far the most explicit video on kwargs and args I've come across. Thanks so much for sharing
@doJLife
@doJLife Год назад
the way he keeps it soo simple, understandable and even fun "Dr. Spongebob Harold Squarepants" 😂 i love it.
@oszi7058
@oszi7058 Год назад
NIce actually someone is using their reach just at random to help other ppl! that's so nice!
@emmanuelsharp7031
@emmanuelsharp7031 Год назад
The way you teach this stuff, even a baby can understand... thanks man. really appreciate
@robertschmidt8624
@robertschmidt8624 Год назад
THANK YOU!! I finally understand *args and **kwargs after at least a year of studying Python. I still have immense respect for my previous instructor, but this video finally gives Me the level of understand I need to write MY own codes. Thank You again.!! Rob
@ken_tx
@ken_tx 7 месяцев назад
You made this easy to understand. Probably the best video I’ve seen on this topic. Thank you!
@RainnFTWj
@RainnFTWj Год назад
Great video as always, Bro Code. However, using the if statements there seems unnecessary as the get() method has a second parameter that sets a default value if the key doesn't exist. For example: kwargs.get('apt', '') The default value is set as '' here which wouldn't show up as anything in the output.
@jankempynck3745
@jankempynck3745 8 месяцев назад
This is the best explanation or *args & **kwargs, that I ever have heard and seen. Congratulations !!!
@juankorsia7909
@juankorsia7909 Год назад
Amazing explication about it. Right now I undertand it. Thanks a lot!!!
@chriskeo392
@chriskeo392 Год назад
Quick and concise Sniper precision Let's get a Sqlalchemy video. Building models and using existing models etc
@subinkv6849
@subinkv6849 4 месяца назад
You are the real coding bro💗
@b00i00d
@b00i00d Год назад
most complete coverage of the subject - thanks!
@Cyborgcupine
@Cyborgcupine 8 месяцев назад
I paused the video and entered state Michigan, unpaused and two seconds later you did as well :O
@DeejayRobert
@DeejayRobert 7 месяцев назад
The bro man is excellent.
@jasper5016
@jasper5016 5 месяцев назад
You are the hope!!
@MK-vu4qt
@MK-vu4qt 7 месяцев назад
What a great explanation! I love you Bro! You're the best. Thank you so much 🙏
@jcdragneel
@jcdragneel Год назад
Thank you Bro. Taking intro to Scripting right now, every so often the reading material DOES NOT hit the mark for me. Glad you always seem to have something about what I am stuck on, cause I for the life of me could not get what the nonsense the reading material was trying to tell me. Pretty sure I will have to keep coming back to review the video with each prompt I need to code into, but still THank you for the video.
@chernoboogaloo
@chernoboogaloo 3 месяца назад
Comment for engagement purposes, good video, I really love the channel
@marymary8195
@marymary8195 Год назад
thank you so much for these tutorials!
@datpham2482
@datpham2482 9 месяцев назад
I'm here just to check how args and kwargs are pronounced, but I find this lesson awesome ultimately!
@Trebrehq
@Trebrehq Год назад
i dont understand how i learned c++ before python and my brains still working
@pankela8883
@pankela8883 Год назад
Thank you so much I really needed this, how did I miss on something this important
@murfdaddydolla
@murfdaddydolla Год назад
Insanely good explanation! Thanks bro!
@d.h.y
@d.h.y Год назад
Your video is in totally another class !!!
@simeonehdhdyxhxy
@simeonehdhdyxhxy Год назад
best coder ever
@someMF_XD
@someMF_XD 2 месяца назад
All hail Dr. Spongebob Harold Squarepants III !!
@MystikPrae
@MystikPrae Год назад
Lots of love from nepal, bro
@casualgamer817
@casualgamer817 Год назад
LK 1:41 / 14:53 Python *ARGS & **KWARGS are awesome
@excelinaccounting8094
@excelinaccounting8094 2 месяца назад
Love it❤
@user-dc7oj3el7o
@user-dc7oj3el7o 6 месяцев назад
Thanks! This was a real nice explanation:)
@user-nh7ob9tw2f
@user-nh7ob9tw2f 8 месяцев назад
Nice video but, i seem that *args are simple in adding but i found it a little bit complex when i write a code for multiplying so if u can show us 1 example in multiply *args please
@happypig8690
@happypig8690 7 месяцев назад
def multiply(*factors): product = 1 for factor in factors: product *= factor return product
@dreddskitv
@dreddskitv 8 месяцев назад
👍👍👍
@WANGLAO-yr8wl
@WANGLAO-yr8wl 7 месяцев назад
Great Job! Very Clear!
@fredperry492
@fredperry492 8 месяцев назад
Awesome thanks
@LupaSeal
@LupaSeal Год назад
Amazing as usual, would be amazing if you can build PHP training course, cannot find a good one to at the level that you teach!
@hakim6933
@hakim6933 Год назад
Bro! you're the man!
@akashcode
@akashcode Год назад
Thank you very much bro code. I am from India...❤❤
@zappozzz
@zappozzz 8 месяцев назад
You do great videos.
@willcucked5575
@willcucked5575 Год назад
amazing
@5coffeebreak2
@5coffeebreak2 5 месяцев назад
Thanks, very useful, simple and clear
@yaekobbonke5704
@yaekobbonke5704 Год назад
Easily understood. Thank you sirr
@jokeguy5946
@jokeguy5946 Год назад
Bro is posting faster than speed of light
@kohukesfr3840
@kohukesfr3840 Год назад
good video :D
@kenhaley4
@kenhaley4 8 месяцев назад
At 12:44 a simpler solution would be to just print(f"{kwargs.get('street')} {kwargs.get('apt') or ''}") (That's two single quotes after the word "or"). This would replace 'None' with an empty string, which is what you want.
@MarjorieRoseMasilang
@MarjorieRoseMasilang 2 месяца назад
@bekturasanbekov1979
@bekturasanbekov1979 Год назад
thx 4 vid bro !
@3minutesbibletruth
@3minutesbibletruth Год назад
Thank you boss for your good work
@jathebest2835
@jathebest2835 Год назад
Thanks, Bro!😎👍
@zabehullahalizadeh2310
@zabehullahalizadeh2310 Год назад
You are like the creator of python Bro.
@wandersonhelmer1810
@wandersonhelmer1810 Год назад
I'd love to see a PHP series
@christianihechi
@christianihechi 3 месяца назад
Thank you!!!
@arushsinghal4490
@arushsinghal4490 Год назад
loved it
@Aerish369
@Aerish369 Год назад
Thank you
@jonydude2645
@jonydude2645 Год назад
Thank you Bro, u r real Chad
@asaadkittaneh2928
@asaadkittaneh2928 Год назад
you are awesome!
@rinrin8455
@rinrin8455 Год назад
thank you so much
@mccauleybacalla2228
@mccauleybacalla2228 7 месяцев назад
ththank you so much
@deadlinedis1949
@deadlinedis1949 9 месяцев назад
thanks
@DspycesRecords
@DspycesRecords Год назад
Thanks Bro👍👍
@xidayoung
@xidayoung 9 месяцев назад
As a non-native English speaker: With this first video I saw from you, you convinced me to subscribe to your channel.
@DarkSoulGaming7
@DarkSoulGaming7 Год назад
Ilysm !!!!
@CheatersCalcc
@CheatersCalcc Год назад
I love you bro:)
@michaeljimenez9203
@michaeljimenez9203 Год назад
hi bro code, i love your videos, how many years did it take you to get to the point to where you are at? It is a lot to learn i am a cs student first year thansk for the info
@Samgenkk
@Samgenkk Год назад
Thanks bro
@saipavan77
@saipavan77 Год назад
Thanks
@kofiramseyarthur4391
@kofiramseyarthur4391 Год назад
Dr. Bro Code III Django series please
@phantomf41
@phantomf41 Год назад
Hey bro, can you make a simple code in python that can print out dates in a sequence that skips several days after a specific number an then repeats? Lets say for example print 5 dates in a range a=5(prints 5 numbers or dates) and b=3(skips next 3) so the output dates should print out like 0,1,2,3,4,8,9,10,11,12,16,17,18,19,20. I want to see how you can do this with your simple and detailed explanation.
@yashindian4233
@yashindian4233 9 месяцев назад
a = 5 # Number of dates to print b = 3 # Number of days to skip after printing # Initialize the current date current_date = 0 # Loop to generate and print the sequence of dates for _ in range(a): print(current_date) # Update the current date to the next date after skipping 'b' days current_date += 1 # Check if we need to skip 'b' days if _ % (a + b) >= a: current_date += b
@Pawlo370
@Pawlo370 9 месяцев назад
instead "pass" you can type "..."
@dj_arimakousei
@dj_arimakousei Месяц назад
print outside outloop isn't add the new line , i can't see it when you execute code
@pinaka4492
@pinaka4492 Год назад
bro please make a Django series
@casualgamer817
@casualgamer817 Год назад
📦
@Pawlo370
@Pawlo370 9 месяцев назад
11:20 in python 3.12 we can
@riddleiddle
@riddleiddle 5 месяцев назад
I am confused with **kwargs example, are any of those values associated with each other? It seems like they're not key:value pairs, just individual strings
@al-cadaalachannel3194
@al-cadaalachannel3194 Год назад
Thanks bro . Where do I get python book?
@simonvanek3389
@simonvanek3389 Год назад
git tutorial when?
@saipavan77
@saipavan77 Год назад
Do you like SpongeBob and squarepants literally you put it in every video 😂
@BroCodez
@BroCodez Год назад
I try and think of characters almost everybody knows of
@saipavan77
@saipavan77 Год назад
@@BroCodez yes thats engaging
@ASHLEYZACHARYCTIGLAO
@ASHLEYZACHARYCTIGLAO Год назад
HELLO GUYS CAN YOU MAKE A PROGRAM THAT SHUFFLES EVERY INPUT LETTER OR NUMBER AND OUTPUTS EVERY POSSIBILITY WITHOUT USING ANY RANDOM OR SHUFFLE FUNCTION. (PERMUTATIONS)
@ZuRqi
@ZuRqi Год назад
In which playlist can we find them from the beginning?
@superquran4512
@superquran4512 Год назад
@Bro Code, I have a small program that needs debugging could you kindly help me please? I learnt a lot from your videos but this seems to be a little too much for me to solve. how can i contact you personally please? Thanks in advance buddy :)
@alfonzokgakole8001
@alfonzokgakole8001 Год назад
Why don't u use vscode
@Marleos
@Marleos Год назад
What IDE do you use bro?
@fabioeliasreisritter8827
@fabioeliasreisritter8827 Год назад
I think he's using pycharm my dude
@Marleos
@Marleos Год назад
@@fabioeliasreisritter8827 Thank you :)
@fabioeliasreisritter8827
@fabioeliasreisritter8827 Год назад
@@Marleos You're welcome bro
@tamilrasam3450
@tamilrasam3450 Год назад
pycharm
@j.j.l3758
@j.j.l3758 11 месяцев назад
is there a reason why your python videos don't use the self. keyword? my class uses it and I get confused with it.
@theoriginalneckbeard
@theoriginalneckbeard 2 месяца назад
May be a bit late, but: in this video he is working with a function, not with a method inside a class. "self" is only used inside classes when you create a method, its a placeholder for the name of the object you create with the help of your class, which serves as a blueprint. A function is a method not bound to a class or an object, a method is a function bound to a class or an object. Its basically the same idea, but the naming varies depending on the context in which the concept is used.
@j.j.l3758
@j.j.l3758 2 месяца назад
Oh thx 🙏
@Runie2607
@Runie2607 Год назад
I've been contributing to a repo recently and in there functions' arguments they have `/` and `*` as follows ``` def function(arg1, arg2, /, *, kwarg1=1, kwarg2=2): pass ``` Can someone explain what `/` and `*` doing in the function arguments??? I've tried googling it but `*args` and `**kwargs` keep popping up
@stonestone9001
@stonestone9001 Год назад
Single asterisk as used in function declaration allows variable number of arguments passed from calling environment. Inside the function it behaves as a tuple.
@Runie2607
@Runie2607 Год назад
@@stonestone9001 Do you know what the '/' is doing???
@stonestone9001
@stonestone9001 Год назад
@@Runie2607 From what I have known, / means divide. For example: x=(8/4) print(x) result will be 2 cause x=(8/4) =2
@kofiramseyarthur4391
@kofiramseyarthur4391 Год назад
Dr. Bro Code III Django series please
Далее
Functions in Python are easy 📞
10:38
Просмотров 448 тыс.
Python lists, sets, and tuples explained 🍍
15:06
Просмотров 260 тыс.
PEDRO PEDRO INSIDEOUT
00:10
Просмотров 1,5 млн
This Is Why Python Data Classes Are Awesome
22:19
Просмотров 801 тыс.
*Args and **Kwargs in Python
3:49
Просмотров 265 тыс.
25 nooby Python habits you need to ditch
9:12
Просмотров 1,7 млн
Learn Python ITERABLES in 6 minutes! 🔂
6:30
Просмотров 4,4 тыс.
Encryption program in Python 🔐
8:41
Просмотров 114 тыс.
Why *ARGS and **KWARGS are Useful in Python
10:44
Просмотров 17 тыс.
Python 101: Learn the 5 Must-Know Concepts
20:00
Просмотров 1,1 млн
Please Master These 10 Python Functions…
22:17
Просмотров 135 тыс.
But what are Python *ARGS & **KWARGS?
7:39
Просмотров 89 тыс.
PEDRO PEDRO INSIDEOUT
00:10
Просмотров 1,5 млн