Python keyword arguments are awesome! 🗝️

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ม.ค. 2025

ความคิดเห็น • 33

  • @BroCodez
    @BroCodez  2 ปีที่แล้ว +11

    # keyword arguments = arguments prefixed with the names of parameters
    # order of the arguments doesn’t matter
    # helps with readability
    # ----- EXAMPLE 1 -----
    def hello(greeting, title, first, last):
    print(f"{greeting} {title}{first} {last}")
    hello("Hello", title="Mr.", last="John", first="James")
    # ----- EXAMPLE 2 -----
    for number in range(1, 11):
    print(number, end=" ")
    print("1", "2", "3", "4", "5", sep="-")
    # ----- EXERCISE -----
    def get_phone(country, area, first, last):
    return f"{country}-{area}-{first}-{last}"
    phone_num = get_phone(country=1, area=123, first=456, last=7890)
    print(phone_num)

    • @berneyww
      @berneyww 2 ปีที่แล้ว

      you r the best

    • @DungNguyên-t2k
      @DungNguyên-t2k ปีที่แล้ว

      Chief điện thoại vivo a3 you Lam my vat cua toi la my niem cuoc doi!!!)))

  • @johnrhodes9964
    @johnrhodes9964 2 ปีที่แล้ว +14

    thanx to bro code, in just 5 days, I learnt enough of python to top my school in computer science exam in my high school junior year. bro is a blessing from the lord

  • @orazovdidar
    @orazovdidar 11 หลายเดือนก่อน +1

    Easy and simple explanation, thank you bro!

  • @deralkekc7022
    @deralkekc7022 7 หลายเดือนก่อน

    Explanation and examples are way clearer and better than what my Uni Professor gives us! Great Job!

  • @AtamrarisTibia
    @AtamrarisTibia 2 ปีที่แล้ว +4

    Bro, thanks to your tutorials I landed a nice job, what the hell? Thanks!

    • @johnsally8320
      @johnsally8320 2 ปีที่แล้ว +1

      That is awesome man! Congratulations to you!! I got into programming recently and found this playlist. If you don't mind me asking, did you do just this playlist or more stuff from BroCode for landing your job? Thanks a ton!!!

  • @Uberdurden
    @Uberdurden ปีที่แล้ว

    excellent!

  • @heal294
    @heal294 ปีที่แล้ว

    thank you for making these videos! you are helping to so much people.

  • @abdulhannan-18
    @abdulhannan-18 ปีที่แล้ว

    Keyword arguments: Preceded by a keyword (the name of the argument at the time of defining the function)
    e.g. when something is print(), the default value for that is end="
    " which we can alter by something enclosed in quotes.
    Similarly with sep
    def greeting(greeting, title, first, last):
    return f"{greeting} {title} {first} {last}"
    print(greeting("Hello", first="Bro", last="Code", title="Mr."))
    Hello Mr. Bro Code
    def greeting(greeting, title, first, last):
    return f"{greeting} {title} {first} {last}"
    print(greeting("Hello", last="Code", title="Mr.", first="Bro"))
    Hello Mr. Bro Code
    def greeting(greeting, title, first, last):
    return f"{greeting} {title} {first} {last}"
    print(greeting("Hello", "Mr.", last="Code", first="Bro"))
    Hello Mr. Bro Code

  • @ghostAlien44
    @ghostAlien44 2 ปีที่แล้ว +1

    You are legend bro 👽👽👽

  • @hshafe001
    @hshafe001 ปีที่แล้ว +1

    There is one problem with this program. If your last 4 digits is something like 0123, the zero causes the following syntax error: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers. Has anybody else run into this problem. Hopefully, in future vids this will be brought up. All - in - all, these are very good lessons. Thanks Bro Code for all the efforts you've put into these vids.

    • @MauricioRomanov
      @MauricioRomanov ปีที่แล้ว +1

      Have you tried turning the number into a string?

    • @samsmokes3100
      @samsmokes3100 11 หลายเดือนก่อน

      Haha you have to make the computer read it as a integer not a string is your mistake

  • @davidbandini3484
    @davidbandini3484 2 ปีที่แล้ว

    Thank you for the video!!

  • @xzex2609
    @xzex2609 2 ปีที่แล้ว

    spongebob squarpants =)))) god , I love his lessons , the best time I had was learning his 12 hour python lessons, I really make the most out of it it took nearly two months. now i just love o hear his voice , cause h e is going into the root of things, the best teacher i have seen in youtube, hands down

  • @krzysiekkrzysiek9059
    @krzysiekkrzysiek9059 2 ปีที่แล้ว +1

    Another perfect explanation. THX Bro

  • @WhoisZero-o1j
    @WhoisZero-o1j 2 ปีที่แล้ว

    You are truly a bro.

  • @mohamedcoufi9873
    @mohamedcoufi9873 6 หลายเดือนก่อน +1

    I'm still wondering what I can do with Python

  • @craftrumzen2393
    @craftrumzen2393 2 ปีที่แล้ว

    Nice, thanks!

  • @XHyperslashX
    @XHyperslashX 2 ปีที่แล้ว

    Thank you very much!

  • @saipavan77
    @saipavan77 2 ปีที่แล้ว

    As usual its perfect

  • @zabehullahalizadeh2310
    @zabehullahalizadeh2310 2 ปีที่แล้ว +2

    Bro you are the best of the best. Thanks a million.

  • @bekturasanbekov1979
    @bekturasanbekov1979 ปีที่แล้ว

    thx 4 vid bro !

  • @softwaredeveloperblog
    @softwaredeveloperblog 2 ปีที่แล้ว

    Cool video. Thank you. I also release a video about the development

  • @ghostAlien44
    @ghostAlien44 2 ปีที่แล้ว +1

    Which Ide you are using

  • @globalcitizen1238
    @globalcitizen1238 2 ปีที่แล้ว

    Awesome....chad

  • @zephyrgaming9798
    @zephyrgaming9798 2 ปีที่แล้ว

    Hey bro when will you start uploading react js videos?

  • @Just_google_404
    @Just_google_404 2 ปีที่แล้ว

    Bro .y school educational system is so messed up that we are using qbasic in school

  • @funstories728
    @funstories728 2 ปีที่แล้ว

    Bro Nation