Question: Please use Python 3.1 Write a Python program (with comments) to do the following: Define a list list1 = ['red1, 'blue', 'yellow', 'green', 'black', 'white',
Please use Python 3.1 Write a Python program (with comments) to do the following: Define a list list1 = ['red1, 'blue', 'yellow', 'green', 'black', 'white', 'pink'] Create a for loop that iterates through each item in list 1 Inside the loop, print the first character of each string OPTIONAL: Modify your code so that you exit from the loop immediately, current string begins with the letter 'g'. A sample session is shown below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
