Boston Python Workshop 6/Friday/CodingBat Using Codingbat: Difference between revisions

Content added Content deleted
imported>Jesstess
No edit summary
imported>Adamf
 
Line 11: Line 11:
We like CodingBat because it gives you immediate feedback on how close your function is to being correct.
We like CodingBat because it gives you immediate feedback on how close your function is to being correct.


Let's walk through an example: [http://codingbat.com/prob/p216579 the sumTwoNumbers] exercise.
Let's walk through an example, the [http://codingbat.com/prob/p216579 sumTwoNumbers] exercise.


If you visit that exercise web page, this is what you'll see:
If you visit that exercise web page, this is what you'll see:
Line 23: Line 23:
This screen:
This screen:
# describes the problem (write a function to add any two numbers together)
# describes the problem (write a function to add any two numbers together)
# shows you the inputs that CodingBat will use to test the function you've written, and the outputs that CodingBat expects to see returned from your function for each input.
# shows you some of the inputs that CodingBat will use to test the function you've written, and the outputs that CodingBat expects to see returned from your function for each input.


The inputs are the values in the parentheses, and the expected output is the value pointed to by the arrows:
The inputs are the values in the parentheses, and the expected output is the value pointed to by the arrows:
Line 31: Line 31:




If you simply click "Go" without typing anything in the box, CodingbBat gives you an error on the right hand side of the screen:
If you simply click "Go" without typing anything in the box, CodingBat gives you an error on the right hand side of the screen: