We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b968404 commit d8b957eCopy full SHA for d8b957e
Lab Cycle 2/program13.py
@@ -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