Python/maths/find_max.py

18 lines
216 B
Python
Raw Normal View History

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