[Tutor] Python Question

bruce badouglas at gmail.com
Sat Jan 11 19:03:02 CET 2014


hey amy..

ok.. before we jump to coding (and forgive me if what I'm about to
type is really basic!) let's play a bit with what's called
psuedo-code.

psuedo-code is a technique to kind of put your thoughts about a
problem/approach in a hash of code/english.. kind of lets you lay out
what you're trying to solve/program.

so for you issue:

you need to think about what you're trying to do.

you want to give the user back something, based on you doing something
to the thing the user gives you.

so this means, you need some way of getting user input
you want to do something to the input, so you need some way of
"capturing" the input to perform the "something" (better known as an
operation) on the user's input..

then you want to redisplay stuff back to the user, so you're going to
need a way of displaying back to the user the data/output..

create the psuedo-code, post it, and we'll get this in no time!



On Sat, Jan 11, 2014 at 12:23 PM, Amy Davidson <amydavidson at sympatico.ca> wrote:
> 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
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list