def find_elementarr,xarr, xarr,x: indices =
for i in rangelen(arr)len(arr)len(arr): if arriii == x: indices.appendiii return indices arr = 1,2,3,4,5,3,6,7,31, 2, 3, 4, 5, 3, 6, 7, 31,2,3,4,5,3,6,7,3
x = 3 result = find_elementarr,xarr, xarr,x if lenresultresultresult > 0: printf"Theelementxisfoundatindex(s):result"f"The element {x} is found at index(s): {result}"f"Theelementxisfoundatindex(s):result"
else: printf"Theelementxisnotfoundinthearray."f"The element {x} is not found in the array."f"Theelementxisnotfoundinthearray."
Пример:
Input: arr = 1,2,3,4,5,3,6,7,31, 2, 3, 4, 5, 3, 6, 7, 31,2,3,4,5,3,6,7,3
x = 3 Output: The element 3 is found at indexsss: 2,5,82, 5, 82,5,8
sure:
def find_elementarr,xarr, xarr,x:indices = for i in rangelen(arr)len(arr)len(arr):
if arriii == x:
indices.appendiii
return indices
arr = 1,2,3,4,5,3,6,7,31, 2, 3, 4, 5, 3, 6, 7, 31,2,3,4,5,3,6,7,3 x = 3
result = find_elementarr,xarr, xarr,x
if lenresultresultresult > 0:
printf"Theelementxisfoundatindex(s):result"f"The element {x} is found at index(s): {result}"f"Theelementxisfoundatindex(s):result" else:
printf"Theelementxisnotfoundinthearray."f"The element {x} is not found in the array."f"Theelementxisnotfoundinthearray."
Пример:
Input:arr = 1,2,3,4,5,3,6,7,31, 2, 3, 4, 5, 3, 6, 7, 31,2,3,4,5,3,6,7,3 x = 3
Output:
The element 3 is found at indexsss: 2,5,82, 5, 82,5,8