Anonymous user
Boston Python Workshop 8/Friday/Tutorial: Difference between revisions
Boston Python Workshop 8/Friday/Tutorial (view source)
Revision as of 23:05, 12 July 2013
, 10 years ago→more choices: if and else
imported>Jesstess |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 281:
fish = "humuhumunukunukuapuaʻa"
name_length = len(fish)
fish + " is a Hawaiian fish whose name is " + str(name_length) + " characters long."
</pre>
Line 558:
====more choices: <code>if</code> and <code>else</code>====
<b><code>if</code></b>
Use the <b><code>else</code></b> keyword, together with <code>if</code>, to execute different code when the <code>if</code> condition isn't <code>True</code>. Try this:
|