list max
This commit is contained in:
parent
4c487f3499
commit
3cfced96f6
8
list.max.for.2.py
Normal file
8
list.max.for.2.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
a = [3, 5, 7, 9, 21, 10, 62, 34, 9, 5, 8]
|
||||
|
||||
maxval = a[0]
|
||||
for i in a[1:]:
|
||||
if i > maxval:
|
||||
maxval = i
|
||||
|
||||
print(maxval)
|
8
list.max.for.py
Normal file
8
list.max.for.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
a = [3, 5, 7, 9, 21, 10, 62, 34, 9, 5, 8]
|
||||
|
||||
maxval = a[0]
|
||||
for i in range(1, len(a)):
|
||||
if a[i] > maxval:
|
||||
maxval = a[i]
|
||||
|
||||
print(maxval)
|
Loading…
Reference in New Issue
Block a user