Skip to content

Commit d8b957e

Browse files
Program 13
1 parent b968404 commit d8b957e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Lab Cycle 2/program13.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Program to Create a list of colors from comma-separated
2+
# color names entered by the user. Display first and last colors.
3+
4+
# Function to find first and last colors in the list
5+
def first_and_last_color(color_list):
6+
print("First color in the list is:",color_list[0]) # First color in the list
7+
print("Last color in the list is:",color_list[-1]) # Last color in the list
8+
9+
print("Enter a list of colors separated by commas:")
10+
color_list = input().split(",") # Split the input string into a list separated by commas
11+
first_and_last_color(color_list) # Function call

0 commit comments

Comments
 (0)