Review the videos and read Chapter 11-13 in the online book of Python 2: For Beginners Only. Use Python to run the following .py Files with the original values and statements. Next, change some of the values to the following. Please keep in mind that statements may change accordingly once you modify the programs. The modified programs must execute correctly. Code is adapted from MITOpenCourseWare, A gentle introduction to programming using Python (under the Open Education Consortium Global Network for Open Education and authorized by the creative commons license). For Example 1, change Hi Class! to Good Morning All For Example 2, change [3, 4, 5, 6] to [1.50, 7, 2.75, 9] For Example 3, change (5, 6, 7, 8) to (100, 101, 102, 103) 1 String Examples.py File # Lecture 4# string_examples.py # Strings # Define a stringnew_string = Hi Class!# Remember we can iterate through itfor letter in new_string: print letter # We can concatenate two strings togethers1 = His2 = Classprint s1 + s2 # but remember, gluing together with a comma adds an extra spaceprint s1, s2 # and with a comma you can glue together different data typesprint s1, 6.189, s2 # We can index the stringprint new_string[0] is, new_string[0]# And slice itprint new_string[0:3] is, new_string[0:3] # We can get the length of our string using the len functionprint len(new_string) is:, len(new_string) # And use various string methods on itprint new_string.upper(), new_string.upper()print new_string.lower(), new_string.lower() 2 List Examples.py File # Lecture 4# list_examples.py # Lists are defined by brackets new_list = [3, 4, 5, 6]print new_list is:, new_list # Just like strings, we can index & slice themprint new_list[2] is:, new_list[2]print new_list[0:2] is:, new_list[0:2] # And iterate through them:for item in new_list: print item # Lists, however, are mutable! So, if we want we can change the# value of one element new_list[2] = 100print new_list is:, new_list # Or, add on a new element with append:new_list.append(87)print new_list is:, new_list # Or insertnew_list.insert(0, 200) # insert at position 0 the element 200print new_list is:, new_list # Or even delete an e
lement using removenew_list.remove(100) # Write in the item that you want to remove from the listprint new_list is:, new_list # Lists are possibly the most useful data structure in Python!# Well see more about them in lab; check out the documentation on# list methods for more cool things to do 3 Tuple Examples.py File # Lecture 4# tuple_examples.py # Tuples are immutable and defined by parentheses new_tuple = (5, 6, 7, 8)print new_tuple is:, new_tuple # We can index them, just like stringsprint new_tuple[2] is:, new_tuple[2] # And iterate through them:for item in new_tuple: print item # Even show how long they areprint Tuple length is:, len(new_tuple) # and iterate through indicies for index in range(len(new_tuple)): print Index is:, index print Value at that index is:, new_tuple[index] # But because they are immutable, we cannot redefine# a single element (remember this does work with lists, though)#new_tuple[1] = 77 # Returns an error # We can also do something called _tuple unpacking_ (a, b, c, d) = new_tupleprint a is:, aprint b is:, bprint c is:, cprint d is:, d # Make sure that you always have the same number of# variables when you unpack a tuple! # Tuples are immutable. To change a tuple, we would need# to first unpack it, change the values, then repack it: # Redefine bb = 77 # Repack the tuplenew_tuple = (a, b, c, d)print new_tuple is now:, new_tuple Once you have executed these programs (1 String Example; 2 List Examples; and 3- Tuple Examples), modify the .py files according to the instructions given to revise the code by program examples. You need to run the IDLE to execute the program changes and review the program results. You can use the Snipping tools or screen print (ctrl + Print Screen) to show the Pythons editors (IDLE) code and results and demonstrate that your program executed correctly. Create a submission file named as ITM205-Case 4-Exercises-YourFirstNameLastName containing executed programs (.py files) for 1 String Example; 2 List Examples; and 3- Tuple Examples. Write a summary document in Microsoft Word format named ITM205-Case 4-Summary-YourFirstNameLastName to show what you have accomplished.