[Tutor] python question

Kent Johnson kent37 at tds.net
Tue Nov 25 18:38:19 CET 2008


On Tue, Nov 25, 2008 at 11:52 AM, Daniel J Kramer
<constantfables at gmail.com> wrote:
> Hi Kent
>
> I have been playing with the ,lower command and am not having much luck.  It
> seems like a simple task, but it is not working for me.  Here is the code
>
> def main():
>     score = 0
>         print"Welcome to the Music Quiz.  Today's game has 8 rounds for you.
> There will be audio rounds, visual rounds and straight ahead qustions. We
> will begin with the round Journey to the Centre of New York"
>         print
>         A11 = raw_input ("We see the Ramones on the Bowery with rolled up
> towels under their arms chewing out a rhythm on their bubble gum.  Where are
> they planning to hitch a ride? ")
>         A11 = A11.lower()

A11 now contains all lowercase characters.

>           if A11 == "Rockaway Beach" :
try
  if A11 == "rockaway beach":

Kent

PS Please use Reply All to reply to the list.

>                 score += 5
>              print "Correct"
>          elif A11 == "CBGB" :
>                    print "That's where they are, not where they are going"
>         else:
>                print "Wrong, they all hitched a ride to Rockaway Beach"
>
>         print "Your total score ", score
>
> main()
>
> Is the placement of the .lower function in the wrong place?  When I run the
> code, the program does not recognize my input and will not give me a score.
> This happens even if I enter text with capitals.  When I remove the .lower
> function Python recognizes my answer, but only if it has capitals.
>
> any suggestions?
>
> cheers
> Daniel
>
>


More information about the Tutor mailing list