Python/CheatSheet: Difference between revisions
< Python
(Leere Seite erstellt) |
No edit summary |
||
Line 1: | Line 1: | ||
== If Then Else == | |||
<blockquote> | |||
<pre> | |||
if x < 0: | |||
print('Negative') | |||
elif x == 0: | |||
print('Zero') | |||
else: | |||
print('More') | |||
</pre> | |||
</blockquote> | |||
== For loops == | |||
<blockquote> | |||
<pre> | |||
for x in ['cat', 'dog', 'bird']: | |||
print (w) | |||
</pre> | |||
</blockquote> | |||
<blockquote> | |||
<pre> | |||
</pre> | |||
</blockquote> | |||
<blockquote> | |||
<pre> | |||
</pre> | |||
</blockquote> | |||
<blockquote> | |||
<pre> | |||
</pre> | |||
</blockquote> | |||
<blockquote> | |||
<pre> | |||
</pre> | |||
</blockquote> |
Revision as of 11:25, 18 September 2017
If Then Else
if x < 0: print('Negative') elif x == 0: print('Zero') else: print('More')
For loops
for x in ['cat', 'dog', 'bird']: print (w)