Part of the series

Several example codes

~1 min read • Updated Oct 13, 2025

Program Overview

This Python program reads 12 numbers from input and stores them in an array.
Then, using a method, it removes the first element (index 0) and displays the updated array.


Python Code:


def remove_first_element(arr: list[int]) -> list[int]:
    return arr[1:]

# Read 12 numbers from user
raw_input = input("Enter 12 numbers separated by space: ")
numbers = list(map(int, raw_input.strip().split()))

if len(numbers) != 12:
    print("You must enter exactly 12 numbers.")
else:
    updated = remove_first_element(numbers)
    print(f"Array after removing first element: {updated}")

Sample Output:


Input: 10 20 30 40 50 60 70 80 90 100 110 120  
Output: Array after removing first element: [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]

Written & researched by Dr. Shahin Siami