148k views
0 votes
Write a program that uses an initializer list to store the following set of numbers in a list named nums. Then, print the first and last element of the list.

56 25 -28 -5 11 -6

User Tarling
by
6.8k points

1 Answer

4 votes

Answer:

Here's a Python program that uses an initializer list to store the given set of numbers in a list named nums and then prints the first and last elements of the list:

Step-by-step explanation:

# Initialize a list named nums with the given set of numbers

nums = [56, 25, -28, -5, 11, -6]

# Print the first element of the list

print("First element:", nums[0])

# Print the last element of the list

print("Last element:", nums[-1])

The program outputs:

First element: 56

Last element: -6

User Javiyu
by
7.0k points