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

no edit summary
imported>Jesstess
No edit summary
imported>Jesstess
No edit summary
Line 43:
 
 
Hmm. I've got one correct and two wrong. MaybeOh! insteadI ofsee - I typed in <code>returnfirst</code> twice, when instead I should usehave used <code>printsecond</code>?:
 
 
[[File:Cbat_print.png|border|center]]
 
 
That's not it. CodingBat problems always want you to use <code>return</code> in your functions. Oh! I see - I typed in <code>first</code> twice, when instead I should have used <code>second</code>:
 
 
Line 56 ⟶ 50:
 
Great!
 
I can check this by typing the same function into the command prompt:
 
 
What CodingBat is doing is the same as when you write a function in your text editor or at the commandPython prompt and then run it a few times, like this:
 
<pre>
awf$ python
Python 2.6.1 (r261:67515, Aug 2 2010, 20:10:18)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def sumTwoNumbers(first, second):
... return first + second
Line 78 ⟶ 66:
</pre>
 
Perfect!
 
<div style="font-size:125%">[http://codingbat.com/home/bostonpythonworkshop@gmail.com/PythonIntro Now we can move on to completing tonight's practice problems]</div>
Anonymous user