Defining functions

Discussion in 'Python' started by Jimith87, Nov 20, 2003.

  1. Jimith87

    Jimith87 Guest

    I'm a newby to python, and have been learning it for a little while, but I
    have a problem. I can't grasp the concept of functions..... If someone could
    explain that in lamers tearms that would be appreciated. One more question, can
    python be applied to manipulate things in Windows? Like maybe restart my
    computer through python, or record keystrokes???

    Thanks alot guys, Pat
    Jimith87, Nov 20, 2003
    1. Advertisements

  2. Jimith87

    Ben Finney Guest

    Welcome! Some time soon you should work through the Python tutorial:

    A function is an object that contains code to be executed. It allows
    you to parcel up a conceptual lump of code that does one distinct thing
    (say, read a number from an input stream, or calculate a value from two
    inputs) and then invoke that bundle of code at other places in your

    A function can return a value, so you can assign that value to another
    object or use it as input to another function. A function can be
    parameterised; that is, you can pass the function one or more input
    parameters that will affect its behaviour.

    Functions allow you to avoid repeating code that is largely similar
    throughout your code; it also allows you to abstract a block of code to
    a single conceptual operation, making the code that uses it easier to

    It sounds like you would benefit from the tutorial "How To Think ike A
    Computer Scientist: Learning With Python". It's here:

    Ben Finney, Nov 20, 2003
    1. Advertisements

  3. Jimith87

    Peter Hansen Guest

    Planning to write some viruses? ;-)

    Peter Hansen, Nov 20, 2003
  4. Hi!

    "Hi, I am a virus. For me to work properly, please install the Python
    interpreter found at first" *lol*

    I think there's an O'Reilly book, "Win32 Programming with Python"; if it
    is possible, it is probably described there.

    Tobias Pfeiffer, Nov 20, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.