Defining functions

J

Jimith87

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
 
B

Ben Finney

I'm a newby to python, and have been learning it for a little while

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

said:
I can't grasp the concept of functions..... If someone could explain
that in lamers tearms that would be appreciated.

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
code.

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
read.


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

<http://www.ibiblio.org/obp/thinkCSpy/>
 
P

Peter Hansen

Jimith87 said:
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???

Planning to write some viruses? ;-)

-Peter
 
T

Tobias Pfeiffer

Hi!

Planning to write some viruses? ;-)

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

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

Bye
Tobias
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top