Python: Display the first and last colors from a given list
First and Last Colors
Write a Python program to display the first and last colors from the following list.
color_list = ["Red","Green","White" ,"Black"]
Pictorial Presentation:

Sample Solution:
Python Code:
Sample Output:
Red Black
Explanation:
The said code creates a list named "color_list" which includes four different colors, "Red", "Green", "White", and "Black". Then, it utilizes string formatting to print the first (Index 0) and the last (Index -1) color of the list together with a space in between. The output would be "Red Black".
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program that prints the second and second-last colors from a given list.
- Write a Python script that takes a list of colors and prints them in reverse order.
- Write a Python program that takes a list of colors and finds the longest color name.
- Write a script to check if a specific color exists in the given list.
Python Code Editor:
Previous: Write a Python program to accept a filename from the user and print the extension of that.
Next: Write a Python program to display the examination schedule. (extract the date from exam_st_date).
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.