How to Start Programming in Python

Python is a good programming language for beginners that continues to be a good programming language when you're no longer a beginner.

Steps

  1. Python is an interpreted language. You don't need a compiler. You need an interpreter, instead. So download it from [1].
  2. After you download the interpreter, read through the instructions for your platform to install it and do so.
  3. Download a good syntax-highlighting code editor. If you're using Windows, Programmer's Notepad is a good choice. In Linux, every little text editor is a syntax-highlighting editor.
  4. Write your first program.
    1. Your first program should be this listing:
  5. # !/usr/bin/env python # print "Hello, World!" #
    1. Create a new file in any directory, and name it "hello.py".
    2. Open a terminal (or console, in Windows). In windows, you do this by clicking Start->Run and typing "cmd" into the prompt.
    3. Now navigate to the directory where you created your first program and type "python hello.py".
    4. Now that you've proved your python installation works and that you can write a program, you are ready for more advanced work.
  6. Read the tutorial at [2].
  7. Now that you've got a good overview of python, and you know how to write a basic script, think of a program you'd like to write. Good examples of programs to write at this level are:
      • Basic checkbook program.


[edit] Tips

  • If python is too hard, try to start out with LOGO, a turtle graphics language.
  • Python is probably the easiest language to start out with, however.
  • In Windows, python isn't usually added to your path initially. You should go ahead and add it.
  • Text editors are a dime a dozen, so if you don't like the one you use, you can try a different one. Python on Windows ships with its own editor called "IDLE".
  • The entire python syntax and core language concepts can be learned in 15 minutes, and can be kept in your head at once. If you're not understanding something, it's probably not python causing the confusion, but rather the fact that you're new to the topic. Take a break, let it cook, and come back when you're in a more pliable state.

Warnings

  • Python is well-documented, but much of the documentation assumes you're coming to python from another programming language. If python really is your first attempt at programming, buy a book.
  • Python is a structured language as well as an object-oriented language. That means there are functions, which originated in mathematics. It is highly recommended that would-be adult programmers have at least a college algebra level of mathematics. However, this is not required, it just makes learning python (and any other structured language) easier to learn.
  • Many people tackle programming initially because they want to write games. Get over it in the beginning, write your games after you've gotten a good command of the language. Game programming can be very difficult, so focus your attention first on learning the language by writing other programs that are both easier and useful to you.
  • Game programming is very difficult! If you're interested in doing more than simple quiz games, you will need a good understanding of mathematics in order to avoid writing a lot of hacky stuff that never really works right. Don't let that scare you, after you've made a few attempts at writing basic games, go learn some mathematics and you'll find the material a lot easier to learn than it sounds.

Things You'll Need

  • About 6 months to learn
  • A good imagination
  • A will to learn
  • The drive to succeed

blog comments powered by Disqus
 
 
 
 
Copyright © PcBerg