how to get the first element of a list code example

Example 1: find the first element in phython list

Alist = ['Sun','Mon','Tue','Wed','Thu']
print("The given list : ",Alist)

print("The first element of the list : ",Alist[0])
print("The last element of the list : ",Alist[-1])

Example 2: python get first n elements of list

l = [1, 2, 3, 4, 5]
print(l[:3])

Example 3: java list get first element

set.iterator().next();

Example 4: how to find first value of an list

// Python
list = [1,2,3]
firstdigit = list[0] // 1 

list = ['Hello', 'bye', 'Adios']
firstvalue = list[0] // 'Hello'