Interaction and debugging, Python Programming


We encourage you to adopt an interactive style of debugging and programming. Use the Python shell a lot. Write short pieces of code and check them.  It is much  simpler to test the individual parts as you go, rather than  to take hours writing a large program, and then search it does not work,  and must sift through all your program, trying  to search the bugs.

But, if you ?nd  yourself in the (inevitable) position of having a big program with  a error in it, do not despair. Debugging a program does not require brilliance or creativity or much  in the way of inside.  What it needs is a systematic and persistence approach.

First of all, have  a test case (a set of inputs to the procedure you are trying  to debug) and  know what  the answer is considered to be.  To check a program, you might  start  with  some  special  cases: what  if the argument is 0 or the empty function? Those cases may  be simpler to sort through ?rst (and are also cases that can be easy to get worse). Then try more specific cases.


Now,  if your  program gets your  test case incorrect, what  could you do?  Resist the temptation to start  changing your  program around, just to watch if that  will ?x the solution. Do not modify  any code until  you know  what  is wrong with  what  you are doing  now, and therefore seems that the modify  you make is going to correct the problem.

Ultimately, for debugging large programs, it is most useful  to use a software development environment  with  a serious debugger. But these  methods may sometimes have  a steep  explaining curve,  so in this class we will study to debug systematically using  "print" statements.


Posted Date: 8/9/2012 6:59:58 AM | Location : United States

Related Discussions:- Interaction and debugging, Assignment Help, Ask Question on Interaction and debugging, Get Answer, Expert's Help, Interaction and debugging Discussions

Write discussion on Interaction and debugging
Your posts are moderated
Related Questions
what is python

Write a program that asks the user to enter a number of seconds. The responses of the program will vary depending on the length of seconds: • If the number of seconds is under 60

In English, specify a representation of the board game in Python. The representation should capture the entire state of the game at one point in time. It may be helpful to first fi

Your task is to construct a translator from the subset of Python in Project 3 intocontinuation-passing style (CPS). Of course, the expected way of accomplishing this is to trans

Java programs are  what  is known as statically and  strongly defined.  Thus,  the  kinds  of all the variables must  be known at the time that the program is written. That seems

draw the variation of pressure with volume of a real gas at temperatures lower than its critical temperature.also draw its surface of discontinuity

This assignment involves writing a program to solve word search puzzles. For example in the following word grid it is possible to find the words active, stock, ethernet and java. N

A program to count how many files are on the file system which displays summary information regarding the total number of bytes used by all files and a breakdown of the number of b

Booleans   Before we talk about  conditionals, we require  to clarify the Boolean  data  type.  It has two values False and True. Typical statement that have Boolean values

Synthetic models One  goal  of various  people in a variety of sub-disciplines of  electrical  engineering and  computer science is automatic synthesis of machine from  formal