Programming and debugging can be part of the same development process.
If you were making a program, testing should really be a regular activity within the software development cycle. If you leave testing until the end, you will have a lot of code and it can be difficult to work through to find the problems. You should always plan to test early and often.
Test-driven development (TDD) is a method for developing computer programs that involves continually repeating the same process of build, test, change, build, test, change, etc. The programmer starts by building something that does not work and then makes the minimum amount of changes required to make it pass a test. Then this piece of code is refactored (rewritten) so that it meets acceptable standards.
Refactoring sections of code may include:
Refactoring the code has two main advantages:
Commenting is used to explain the function of different sections of code. This is to make it easier to read. This section of code has had comments added to make it more readable:
# store two values and print the sum first = input("Input the first number") #store first value second = input("Input the second number") #store second value print("The sum is",first+second) #print the sum
If programmers leave helpful comments in the code, it makes it easier for others to understand what purpose each section of code performs.