last lab
This commit is contained in:
20
labPython/lab5/Spis12.py
Executable file
20
labPython/lab5/Spis12.py
Executable file
@@ -0,0 +1,20 @@
|
||||
ArrayStatic = (1, 2, 34, 53, 20, 10)
|
||||
maxNum = 0
|
||||
maxIndex = 0
|
||||
minNum = ArrayStatic[0]
|
||||
minIndex = 0
|
||||
|
||||
for index in range(0, len(ArrayStatic)):
|
||||
if maxNum < ArrayStatic[index]:
|
||||
maxNum = ArrayStatic[index]
|
||||
maxIndex = index
|
||||
if minNum > ArrayStatic[index]:
|
||||
minNum = ArrayStatic[index]
|
||||
minIndex = index
|
||||
|
||||
print(ArrayStatic)
|
||||
ArrayStatic = list(ArrayStatic)
|
||||
ArrayStatic[maxIndex] = minNum
|
||||
ArrayStatic[minIndex] = maxNum
|
||||
ArrayStatic = tuple(ArrayStatic)
|
||||
print(ArrayStatic)
|
||||
Reference in New Issue
Block a user