On 27/9/2013 13:04, Jacqueline Canales wrote: > composers = ['Antheil', 'Saint-Saens', 'Beethoven', 'Easdale', 'Nielsen'] > x = 'Antheil' > s = 'Saint-Saens' > h = 'Beethoven' > y = 'Easdale' > k = 'Nielsen' > > if s[0] == 'S' or s[0] == 's' == s[-1] == 'S' or s[-1] == 's': > if y[0] == 'E' or y[0] == 'e' == y[-1] == 'E' or y[-1] == 'e': > if k[0] == 'N' or k[0] == 'n' == k[-1] == 'N' or k[-1] == 'n': > print(s,k,y) > else: > print(" ") > > ####Answer i Got Below >>>> > Saint-Saens Nielsen Easdale >>>> > > Is this what i was going for in the direction i was a bit confused if we > were suppose create loops or if statements that are verified in the actual > composers list. I don't know i feel as if i know what i need to do i just > cant put it together. >
At this stage of your experience, don't try to solve the whole thing in one monolithic piece of code. Those names shouldn't be in separate variables. For now, just write a function that takes a name as a parameter, and attempts to return either True or False, to indicate whether it matches. Then after you've debugged that, put those names back into a list, and write a loop which calls the function you just wrote. <SNIP> > </div></div><span><font color="#888888">--<br> > Dharmit Shah<br> > <a href="http://www.about.me/dharmit" > target="_blank">www.about.me/dharmit</a><br> > </font></span><div><div>_______________________________________________<br> > Tutor maillist - <a href="mailto:Tutor@python.org" > target="_blank">Tutor@python.org</a><br> > To unsubscribe or change subscription options:<br> > <a href="https://mail.python.org/mailman/listinfo/tutor" > target="_blank">https://mail.python.org/mailman/listinfo/tutor</a><br> > </div></div></blockquote></div><br></div> > </div></div></blockquote></div><br></div> > Please post in text mode. html mail will mess you up, sooner or later. Besides, it adds unnecessary bulk to the message, which matters to those of us who pay by the byte. -- DaveA _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor