[Tutor] Newb Learning Question
Jeffrey Dates
kungfukoi at gmail.com
Wed Apr 2 20:26:42 CEST 2008
That's Bob, and Tony, exactly what I'm looking for. ( not the answer, but
the path to it... )
Let me get back to you with my result after I study this a bit.
thanks!!
Jeffrey Dates
www.kungfukoi.com
On undefined, bob gailer <bgailer at alum.rpi.edu> wrote:
> Jeffrey Dates wrote:
> > Greetings,
> >
> > I have no previous experience in scripting. Python is my first
> > language...
> > I'm currently trying to build a logic model for how to 'think' in
> > Python, so please excuse my ignorance.
> >
> > Currently, I'm running through some basic 101 tutorials, to wrap my
> > head around solving problems.
> > I'm looking for some advice on how to solve the following exercise:
> >
> > "Write a program that prints the first letter of a string that comes
> > after 'm' in the alphabet."
> >
> > what I had so far:
> >
> > for code in range(ord("a"), ord("z") +1):
> > if code == ord("m"):
> > print chr(code +1)
> >
> > Now, this solves for the first letter after "M"
>
> which is NOT what the exercise wants!
>
> Consider "are you ready?". Which character is the first that comes after
> 'm' in the alphabet."?
>
> BTW did you mean after "m"? Caps and lower case are different.
>
> > , but doesn't do it via a string....
>
> I for one am reluctant to just give an answer. I prefer to lead you to a
> solution.
>
> So, I suggest you write a program to:
> assign a candidate string to a variable (choose a string that has at
> least one letter that "comes after 'm'")
> test each character to see if it "comes after 'm'"
> print that character
> stop
>
> Do as much as you can, and ask more questions.
>
> --
> Bob Gailer
> 919-636-4239 Chapel Hill, NC
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080402/d292386d/attachment.htm
More information about the Tutor
mailing list