Oct-05-2017, 11:36 AM
As part of a quiz in Python, we were asked to create a for loop that would then print all elements of the string that begin with or end with the letter "z". I can only get the first [0] or last [-1] o print but not both.
latest attempt prints only pizazz
latest attempt prints only pizazz
words = ["pizazz", "python", "zebra", "pizza"] for word in words: if word[0] and word [-1] in "z": print wordDo I need another if statement or what is the correct syntax?