def substitution(list1, number):
row = 0
for i in range(0, len(list1)):
if(int(list1[i])>number):
list1[i] = number
row += 1
print("The number of substitution " +str(row))
print("The new sequence is: ", format(list1))
#Testing the function
list1 = [9,10,11,12,20,23]
substitution(list1,13)
Comments
Leave a comment