[Tutor] Python Question

Amy Davidson amydavidson at sympatico.ca
Sat Jan 11 18:23:29 CET 2014


Hey!
So luckily with the texts that were sent to me, I was able to figure out the answer(yay)!

Unfortunately I am now stuck on a different question.

"Write a function called highlight() that prompts the user for a string.
Your code should ensure that the string is all lower case.
Next, prompt the user for a smaller 'substring' of one or more characters. 
Then replace every occurrence of the substring in the first string with an upper case.
Finally, report to the user how many changes were made (i.e., how many occurrences of the substring there were).”
On Jan 11, 2014, at 1:04 AM, Alex Kleider <akleider at sonic.net> wrote:

> On 2014-01-10 17:57, Amy Davidson wrote:
>> Hey Danny,
>> I just started taking the course (introduction to Computer Science) on
>> last Tuesday, so I am not to familiar. I have been doing my best to
>> understand  the material by reading the text book, Learn Python the
>> hard way.
> 
> A lot of people seem to think "the Hard Way" is the way to go.  I disagree.  I found that Allen Downey's book is excellent and free (although the book is also available in 'real' print which works better for me.)
> 
> http://www.greenteapress.com/thinkpython/
> 
> My copy covers Python 2.7, you use Python 3 I believe, but I doubt that that will be too much of a problem.  At the intro level the differences are few.
> 
> ak
> 
>> In my quest to answer the question given to me, I have searched the
>> internet high and low of other functions thus, I am familiar with the
>> basic knowledge of them (i.e. starting with def) as well as examples.
>> We can attempt the approach to the method that you prefer.
>> Thans for helping me, by the way.
>> On Jan 10, 2014, at 5:25 PM, Danny Yoo <dyoo at hashcollision.org> wrote:
>>> On Fri, Jan 10, 2014 at 2:00 PM, Keith Winston <keithwins at gmail.com> wrote:
>>>> Amy, judging from Danny's replies, you may be emailing him and not the
>>>> list. If you want others to help, or to report on your progress,
>>>> you'll need to make sure the tutor email is in your reply to:
>>> Hi Amy,
>>> Very much so.  Please try to use "Reply to All" if you can.
>>> If you're wondering why I'm asking for you to try to recall any other
>>> example function definitions, I'm doing so specifically because it is
>>> a general problem-solving technique.  Try to see if the problem that's
>>> stumping you is similar to things you've seen before.  Several of the
>>> heuristics from Polya's "How to Solve It" refer to this:
>>>   http://en.wikipedia.org/wiki/How_to_Solve_It
>>> If you haven't ever seen any function definition ever before, then we
>>> do have to start from square one.  But this would be a very strange
>>> scenario, to be asked to write a function definition without having
>>> seen any previous definitions before.
>>> If you have seen a function before, then one approach we might take is
>>> try to make analogies to those previous examples.  That's an approach
>>> I'd prefer.
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140111/ae7e6d2d/attachment-0001.html>


More information about the Tutor mailing list