Largest without max · หาเลขมากสุดโดยไม่ใช้ max
Largest without max
Return the largest number in a list without using Python's max.
Keep the best value found so far, starting with the first item. Walk through the list and replace the best value whenever you meet a bigger one. When the loop ends, the best value is the largest.
ค่ามากที่สุดโดยไม่ใช้ max
คืนค่าตัวเลขที่มีค่ามากที่สุดในรายการโดยไม่ต้องใช้ Python's max.
เก็บค่าที่ดีที่สุดที่พบมาจนถึงปัจจุบัน, เริ่มจากไอเท็มแรก. เดินผ่านรายการและแทนที่ค่าที่ดีที่สุดทุกครั้งที่เจอค่าที่ใหญ่กว่า. เมื่อลูปสิ้นสุด, ค่าที่ดีที่สุดคือค่าที่ใหญ่ที่สุด
Write largest(nums) that returns the largest number in the list, without using max. · เขียน largest(nums) ที่ คืนค่า เลขที่มีค่ามากที่สุด dalam รายการ โดยไม่ใช้ max
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่