TheAlgorithms-Python/maths/find_max.py

18 lines
216 B
Python
Raw Normal View History

2018-10-23 02:36:08 +08:00
# NguyenU
2019-10-05 13:14:13 +08:00
2018-10-23 02:36:08 +08:00
def find_max(nums):
max = nums[0]
2018-10-23 02:36:08 +08:00
for x in nums:
2019-10-05 13:14:13 +08:00
if x > max:
max = x
2018-10-23 02:42:08 +08:00
print(max)
2019-10-05 13:14:13 +08:00
2018-10-23 02:42:08 +08:00
def main():
2019-10-05 13:14:13 +08:00
find_max([2, 4, 9, 7, 19, 94, 5])
2018-10-23 02:42:08 +08:00
2019-10-05 13:14:13 +08:00
if __name__ == "__main__":
main()