top posting fixed


On Fri, Sep 27, 2013 at 10:04 AM, Jacqueline Canales
<jackiexxd...@gmail.com <mailto:jackiexxd...@gmail.com>> 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.


On 28/09/2013 00:59, wesley chun wrote:> hello,
>
> well, i have to say that you've at least made a good start at a
> solution. right now you're thinking about it very much like a human. try
> to put yourself into the shoes of a computer: how can we solve this task
> for just ONE name?
>
> once you have that solution, then you can apply the same solution for
> all names by looping over or iterating through them. in your solution,
> you tried to do everything at once using brute force.
>
> i recommend you take the lessons learned you borrow some of that code
> and solve it for a single name. for example, take a look at this pseudocode:
>
> name = 'Guido'
> if name first letter == name last letter: # turn this into real Python
> using what you have
>      print 'match'
> else:
>      print 'not a match'
>
> then add the collection and a loop, and you'll be at your solution!
>
> best of luck!
> --wesley
>

I'd like to see the above work, e.g. how do you correctly compare the letters in 'Amanda'?

--
Cheers.

Mark Lawrence

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to