I want to learn Python!

Hi! I want to learn Python! Does anyone know any video tutorials about Python basics, because I don’t even know how to start writing a script (yet). Even making a tutorial from a reply would be nice. Thanks in advance! : )

yea read this first
http://en.wikibooks.org/wiki/Non-Programmer's_Tutorial_for_Python/Contents

then read this when you understand this it’s about the ge
http://www.blendenzo.com/tutBeginningBGEPython.html

http://www.diveintopython.org/toc/index.html

Dive Into Python - Generally agreed to be the best place to start learning. Excellent resource that really helps you understand the concepts behind Python.

Here are also some nice links, especially the last two (A Byte of Python and the Quick Reference).

Don’t forget http://docs.python.org

/Nathan

If you’re not a programmer:
http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python
do everything without cheating.

Thanks for all the links!

“Learning to Program”
http://www.freenetpages.co.uk/hp/alan.gauld/

Thanks manu_di, nice site!

I am trying to learn python as well. I’ve read through most of the Byte of Python pdf and it is pretty helpful. So I can recommend that one from experience.

I can teach Python thrugh email . I am not very expert, but i Can do. mail me at [email protected]
This is completely python controlled finger touch button animation
My Python Work sample http://video.google.com/videoplay?docid=-2099738968121825399
This is completely Python scripting for creating 4 legged walk cycle.
http://video.google.com/videoplay?docid=-5597448661088555013

Those are pretty cool. Would you be willing to share the scripts? I’m trying to learn python as well and think I know enough to be able to decipher a script. I eventually want to do some animations involving disc jockying so the the button one would be particular interest to me. Or to put it in python:

answer = raw_input('Will you share the scripts? ')

if (answer == 'yes') or (answer == 'Yes'):
          print 'Thanks for saying %s.' % (answer)
else:
          print 'Awww that is too bad.'

Lol, nice script, linuxpimp21. One suggestion though:

Instead of

if (answer == 'yes') or (answer == 'Yes'):

you can also use

if answer.lower() == 'yes':

That way you’ll also catch ‘YES’, ‘yEs’ etc. :slight_smile:

ok thanks - as you can tell I am a beginner with the language. I also thought of this one:

answer = raw_input('Will you share your scripts? ')

while answer.lower( ) == 'no':
          print 'That is not the correct answer!'
          answer = raw_input('Will you share your scripts? ')
          
          if answer.lower( ) == 'yes':
                    print 'Thank you!'
                    break

I don’t remember if that is the right way to use while though. Probably could be written more concise.

Also nice, very good so far. But with that code, what happens if the very first answer is yes already? There’s nothing to catch that yet. But you can write it a bit differently to tackle that problem:

For the while condition, you could catch everything except ‘yes’ by writing:

while answer.lower() != 'yes':

Then you wont need the if block inside the loop. You can just give the thank you message when the loop terminates (when the answer is yes).

I also am not sure that it’s allowed to put a space between the brackets of function calls, like you seem to have done in “answer.lower()”.

i like this very much:
http://docs.python.org

including this handy Quick-Reference-Sheet:
http://www.brunningonline.net/simon/python/PQR2.1.html
the later makes only sense if you already know the basics.

I would prefer writing it as:


def shareScripts():
    answer = raw_input('Will you share your scripts?')

    if answer.lower() == 'no':
        print 'That is not the correct answer'
    
    elif answer.lower() == 'yes':
        print 'Thank you!'
    
    else:
        print 'Does not compute, try again'
        shareScripts()

shareScripts()


I also am not sure that it’s allowed to put a space between the brackets of function calls, like you seem to have done in “answer.lower()”.
I know that. I mainly did that because it looked ugly. I know whitespace is important in python but I thought mainly that is the indention so the interpretor can separate the blocks of code. Out of curiosity I tested it out with this script.


#function space test

answer = raw_input('Enter Something! ')

if answer.lower(     ) == 'no':
    print 'Meanie! :/'
else:
    print 'Thank you.  I am not too needy am I? 

...

DON\'T ENTER ANYTHING FOR THAT ONE!'

I tried 5 spaces in answer.lower() and got no error message. Of course there is no real reason to have 5 spaces so it would be neater to just do (). For some reason it bugged me that it looked like that and that is the only reason I did ( ). lol

Recursive functions has their use, but rewriting simple loops as a recursive function just because you can is a really bad practice.

Another good online book, especially for first-time programmers (i.e., didn’t previously program in some other language), is “How to Think Like a Computer Scientist:
Learning with Python”, by Jeffrey Elkner, Allen B. Downey and Chris Meyers

http://http://openbookproject.net//thinkCSpy/