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) toPlease 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!