Respuesta :
Below is the required Python code for the program.
Python
Program code:
# Starting the code
# Defining a function
def same_ends(lst, n):
# Starting a loop
if lst[:n] == lst[-n:]:
return True
else:
return False
# Testing the function
lst = [1, 2, 3, 4, 99, 1, 2, 3, 4]
# Printing the values
print(same_ends(lst,4))
print(same_ends(lst,3))
Explanation:
- Starting the code.
- Defining a function.
- Starting a loop.
- Testing the function.
- Printing the values.
- End up a code.
Output:
Find below the attachment of the code output.
Find out more information about python here:
https://brainly.com/question/26497128
