Complete the code to remove the first element from the slice.
arr := []int{1, 2, 3, 4, 5}
arr = arr[[1]:]
fmt.Println(arr)To delete the first element, slice from index 1 to the end.
Complete the code to print the new length of the slice after deleting the first element.
arr := []int{10, 20, 30, 40}
arr = arr[1:]
fmt.Println(len([1]))After slicing, arr holds the new slice. Use len(arr) to get its length.
Fix the error in the code to delete the first element and print the updated slice.
arr := []int{5, 6, 7, 8}
arr = arr[[1]]
fmt.Println(arr)To slice from index 1 to end, use arr[1:]. Using arr[1] accesses a single element, not a slice.
Complete the code to delete the first two elements and print the updated slice.
arr := []int{9, 8, 7, 6, 5}
arr = arr[[1]:]
fmt.Println(arr)To slice from index 2 to end, use arr[2:].
Fill both blanks to delete the first element, append 100, and print the slice.
arr := []int{1, 2, 3}
arr = arr[[1]:]
arr = append(arr, [2])
fmt.Println(arr)arr[1:] removes first element. append(arr, 100) adds 100 at the end.
