Python default arguments are awesome! 👍

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 มิ.ย. 2024
  • #python #tutorial #course
    00:00:00 default arguments
    00:03:16 exercise
    ---- EXAMPLE ----
    def net_price(list_price, discount=0, tax=0.05):
    return list_price * (1 - discount) * (1 - tax)
    print(net_price(500))
    print(net_price(500, 0.1))
    print(net_price(500, 0.1, 0))
    ---- EXERCISE ----
    import time
    def count(end, start=0):
    for x in range(start, end+1):
    print(x)
    time.sleep(1)
    print("DONE!")
    count(10)
    count(30, 15)

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

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

    # ----- EXAMPLE -----
    def net_price(list_price, discount=0, tax=0.05):
    return list_price * (1 - discount) * (1 - tax)
    # print(net_price(500))
    # print(net_price(500, 0.1))
    # print(net_price(500, 0.1, 0))
    # ----- EXERCISE -----
    import time
    def count(end, start=0):
    for x in range(start, end+1):
    print(x)
    time.sleep(1)
    print("DONE!")
    # count(10)
    # count(30, 15)

    • @why-u-alive
      @why-u-alive ปีที่แล้ว +1

      Please make more on default arguments...

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

      Bro they actually are awesome I always use them

  • @e-dit-z3974
    @e-dit-z3974 ปีที่แล้ว +19

    You deserve millions

  • @ViktorSamosiuk-wu5fq
    @ViktorSamosiuk-wu5fq 10 วันที่ผ่านมา

    It is absolutely great! I like python.

  • @auggiea9195
    @auggiea9195 ปีที่แล้ว +3

    U are so good at explaining these concepts! Thank u!

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

    Thank you for an awesome video. I found your videos while I was making a video on creating the Snake game in Python. Subscribed immediately 😆

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

    Thanks for everything. Keep going.

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

    Well explained ❤️

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

    Your explanation is very good and clear. Love your vids bro

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

    thank you so much for the video

  • @Dexeyz
    @Dexeyz 9 หลายเดือนก่อน

    amazingly underrated video, explained perfectly. thank you bro code

  • @sumitpaul2003
    @sumitpaul2003 ปีที่แล้ว +5

    By any chance did you make any videos on introduction to Git & GitHub for beginners?... Ur videos are nicely explained and really thx, i really learned basics of python through your videos

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

    thx 4 vid bro !

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

    Good voice and excellent explanation 👍.

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

    nice tut

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

    You're amazing!!!

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

    How are you so good at explaining stuff so easy

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

    Perfect

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

    defaults arguments are defaults,love them :) thx

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

    wooow, ty for the vid ngl my teacher exaplaining this made no sence.
    btw what does time.sleep(1) do?

  • @Its.all.goodman
    @Its.all.goodman ปีที่แล้ว

    Cool buddy 😎 👍

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

    Nice

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

    How did you add Fundraiser symbol, can you please provide me some info.

  • @The-Martian73
    @The-Martian73 ปีที่แล้ว

    Mr. Bro , you're awesome
    Yeah, let's defeat the TH-cam algorithm 🥋

  • @NamNguyen-mz4yh
    @NamNguyen-mz4yh ปีที่แล้ว

    Well u can adjust the time in time.sleep() by how fast do u want to

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

    Sir please make the video on sql sir

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

    It can be used in a video game made in Python... 🤔

  • @Sturziii
    @Sturziii ปีที่แล้ว +3

    I am currently learning Java. Is this approach the same as "overloading methods" ?

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

      very similar

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

    Can you please make more java swing apps!!

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

      I'm taking a break from Java for now, there's 150+ videos lol

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

    Please make node js react vue js tutorials why all the time the same pyhthon and MySql

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

      that's what people voted for in the past

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

      @@BroCodez please do Nodejs

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

    brooo

  • @Y-and-A
    @Y-and-A หลายเดือนก่อน

    Such a Chad

  • @Uberdurden
    @Uberdurden 6 หลายเดือนก่อน

    def products(we_bougt, its_price, its_total_taxes):
    print(f'we bought a {we_bougt}')
    print(f'its total price is a {its_price} dollar')
    print('total taxes is', its_total_taxes )
    print('total is you will pay is a',its_price + its_total_taxes)
    products('Xbox Series S', 550 , 0.15)
    WE CAN MAKE SOMETHING ON LIKE THAT WE DO NOT NEED TO A RETURN THINGS:)))))

  • @hashimgoran8724
    @hashimgoran8724 7 หลายเดือนก่อน +1

    Fortnite default😂😂

  • @dolevzulta1403
    @dolevzulta1403 6 หลายเดือนก่อน

    תעשה לי ילד