On Tue, Feb 18, 2014 at 5:15 PM, Chinanu 'Chinex' Onyekachi
<chi...@live.com> wrote:
> I’m having difficulties uppercasing a single portion (e.g. hAt) and two
> portions (e.g. HaT) of the string.


[Adding tutor@python.org to CC.  Please use reply-to-all in future
emails on this list.  Thanks!]


Hi Chinanu,


There is a crucial key to this problem.  You must work with a _simpler
problem_ and a _partial solution_, and keeping it up to date as you
learn more and more about the problem and solution.


What does a "simpler problem" mean here?  What does a "partial solution" mean?



Let's take the case where we're trying to compute the combinations for "hat".

Let's call this C("hat").  From your problem statement about, we know
what C("hat") looks like.



Here's a  subquestion of C("hat"): what are the combinations for "h"?

That is, what do we know about C("h")?

    C("h")   -->   ["h", "H"]

Trivial case, but worth thinking about.




Here's another subquestion of C("hat"): what are the combinations for "ha"?

That is, what do we know about C("ha")?

    C("ha")   -->   ["ha", "Ha", "hA", "HA"]

This we know without having to do any coding.



But it's worth thinking: can we get C("ha") easily out of C("h")?

Yes.

Just take the results of C("h"), and put "a" or "A" at the end of each.

    C("h")   -->   ["h", "H"]
    C("ha")   -->  ["ha", "hA",
                        "Ha", "HA"]




Here's another subquestion of C("hat"): what are the combinations for "hat"?

But it's worth thinking: can we get C("hat") easily out of C("ha")?

Yes.




Hopefully that sketches out what I think is the intent of this problem.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to