Find The Maximum Number In A List Without Using max() | Python Example

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ส.ค. 2022
  • How to find the largest number in a list in Python WITHOUT using the built-in max() function. Source code: github.com/portfoliocourses/p.... Check out www.portfoliocourses.com to build a portfolio that will impress employers!

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

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

    You're a godsend for us junior developers. I salute you and your content and everything about you! Thanks a lot bro

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

      You’re very welcome and thank you for such kind words, it means a lot to me to hear this channel is helping you out! :-)

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

    Cool! I'm glad I've just found your channel.
    Subscribed.
    Cheers. Thanks for the explanation.

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

      You're welcome Raphael - and welcome aboard! :-)

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

    it's work cause 9 is the last value but if the last value was 8, it's superior than 3 but not the max

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

      The code will work no matter what the numbers in the list are. :-)

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

      @@PortfolioCourses I didn’t read correctly my bad

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

    why my max is always = list[0] = 3 ?

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

      The code for this video is here: github.com/portfoliocourses/python-example-code/blob/main/find_max.py. That code should not always give you a max of list[0] = 3. :-) I'm not sure why your code would do that, but it sounds like something is incorrect about the way the algorithm is implemented. Maybe you can compare your code to this code and find the difference. It could be something small like a variable name or spacing issue.

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

      @@PortfolioCourses u know what, i am wrong between '=' and '=='

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

      Oh that makes sense, I'm glad you figured it out! :-)

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

    Not a problem for people who started programming with C language.

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

      I agree. 🙂 I've noticed teachers will assign Python questions like this to their students to help them understand a lot of the "basic algorithms" that we get automatically in Python with functions like max().

    • @user-tz2zz5ij1s
      @user-tz2zz5ij1s ปีที่แล้ว

      Python is the big language to learn now. It’s what is taught in the freshman introduction engineering classes in college. But it is taught with the restrictions of not being allowed to use the built in functions. Any university taught student doesn’t get the luxury of all those built in functions. Hence why I am here for a refresher.

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

      @@user-tz2zz5ij1s I've noticed the exact same thing. Teachers still want students to learn "the foundations" so they'll restrict usage of these sorts of functions that do things automatically. 🙂

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

    1:39

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

      Is there something about this point in the video you wanted to point out? :-)

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

      @@PortfolioCourses No it is the code. 😉

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

      Oooh I see haha, there is a link in the description to the code too, just so folks know! :-)

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

      ​@@PortfolioCourses Ok thank you I subscribed your channel.😃

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

      @@staacademy611 Awesome, welcome aboard! 🙂