Python: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
Created page with "= Python 2 and 3 differences = <syntaxhighlight lang="python"> print "fred" // OK Python 2 print("fred") // Not OK Python 2 </syntaxhighlight>"
 
No edit summary
Line 1: Line 1:
= Python 2 and 3 differences =
= Intro =
== Python 2 and 3 differences ==
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
print "fred" // OK Python 2
print "fred" // OK Python 2
print("fred") // Not OK Python 2
print("fred") // Not OK Python 2
</syntaxhighlight>
== Whitespace  ==
Uses four spaces instead of brackets e.g.
<syntaxhighlight lang="python">
for i in range(5):
    x = i * 10
    print(x)
</syntaxhighlight>
</syntaxhighlight>

Revision as of 03:56, 15 July 2020

Intro

Python 2 and 3 differences

print "fred" // OK Python 2
print("fred") // Not OK Python 2

Whitespace

Uses four spaces instead of brackets e.g.

for i in range(5):
    x = i * 10
    print(x)