Login

Back

How to get help when you are stuck!

teacher1 smallLearning to program is fantastically rewarding. You will learn many problem-solving skills as you learn how to program in Python and these skills are known as 'transferable skills'. That's because the skills you learn when learning programming can be applied to many other non-programming areas of your studeis and life in general. For example, in programming, you learn how to take complex problems and break them down into manageable chunks. You learn how to be logical and systematic when attacking complex problems. You learn the importance of 'abstraction' - producing models you can understand of something that is very complex. You learn how to track down problems, how to test things properly and so on. These are all skills that can be used in non-programming areas as well as in programming itself.

It can be a frustrating business learning your first language but there is a lot of help out there. It is important that you develop the skills and knowledge to be able to get help when you are stuck. You will quickly expand your knowledge of Python and programming by a huge amount by having problems so be happy when things don't work out at first!

A note about Python 3.x and Python 2.x ...
Although the differences are small, when using online help, ebooks or text books, always make sure you are looking at resources associated with a version of Python 3.x and not and earlier version of Python 2.x.

1. The interactive help utility. When you open up the interactive interpreter shell in Python, you can type help() to enter the interactive help utility. You can then just type keywords or topics to get some immediate help and examples. You can get a list of available modules, keywords, or topics, type "modules", "keywords", or "topics". Modules also come with a summary of what it does; to list the modules whose summaries contain a given word such as "spam", type "modules spam". To quit this utility, just type quit.

2. Help in the interactive interpreter shell. When you are using the interpreter, you can get help on any particular object by typing  you can also type help(object). For example, try typing this into the interpreter:

a = 10
help(a)

or 

help('string')

3. The Python tutorial. A huge amount of effort has gone into making a beginner's tutorial. You can find it here: http://docs.python.org/3.3/tutorial/

4). The Python documentation. Again, a huge amount of effort has gone into making the documentation in Python clear and accessible to everyone. You will find a lot of help on all aspects of Python you use. For example, you will no doubt want to know about what you can do with strings or lists (their 'methods') at some point. You will want to know what is available in the random module or the turtle module or what other standard libraries are available for you to use. Make yourself familiar with the Python documentation, which can be found here: http://docs.python.org/3.3/index.html

5. Type and id. There are lots of functions in Python that can help you. Two useful ones to get you started are type() and id(). Type identifies the data type of a piece of data for you whereas id gives you the unique number Python assigns to each object in your program - useful to check that two objects that look different really do have different id numbers (don't worry if this sounds confusing. You will understand the importance of this as your skills develop). Try this in the interpreter:

a = 10
b = ''Hello"

type(a)
type(b)
id(a)
id(b)

6. Using Google. If you get stuck on a particular thing in Python, make sure you know how to search Google effectively. Using phrases like 'Python 3', 'examples' and 'problem' along with words related to your problem often yield helpful results. E.g. if you are stuck on how to use a WHILE statement, search for Python 3 while examples or Python 3 how do you use while or Python 3 while problem.

7. eBooks. There are a lot of free eBooks available on the Internet as well as books you can buy. Try searching the Internet for Python 3 free beginner eBooks. Try searching eBay for Python 3 books or online bookstores. Do make sure that what you are looking for is for Python 3 and not a version of Python 2.

8. Python recommendations. There is a list of recommended resources on the right hand side of this page.

9. Each other and your teacher. There is a lot to be said for working with your peers. When you start work, you will rarely work on your own but will be part of a team. Learning how to ask for help, how to offer to help, how to share your knowledge and how to benefit from others' experiences are very important skills. Don't forget to ask your teacher for help, too. The trick here is to be able to express clearly and concisely to your teacher what the problem is, what you've tried to do to solve it and what results you are getting.

10. Commenting out sections of your code. When you have a problem in a big piece of code, you need to try and narrow down where the problem is happening. One very powerful technique is to disable parts of your code which appear to be okay, and then running a much smaller program to see if you can spot where things are going wrong. One easy way to do this is to comment out sections of code and then uncomment them when you have finished. You can do this using the hotkeys ALT+3 and ALT+4 or from the 'format' menu in Python. There are other techniques that will help you, such as writing code in functions, adding comments and spacing to code and dry-running code on paper, but make sure you learn how to use commenting out lines of code as it will save you a lot of time.

Back