Editing Boston Python Workshop 8/Data types

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 67: Line 67:
  
 
<pre>
 
<pre>
>>> print("Hello" + "World")
+
>>> print "Hello" + "World"
 
HelloWorld
 
HelloWorld
 
</pre>
 
</pre>
Line 73: Line 73:
 
<pre>
 
<pre>
 
>>> name = "Jessica"
 
>>> name = "Jessica"
>>> print("Hello " + name)
+
>>> print "Hello " + name
 
Hello Jessica
 
Hello Jessica
 
</pre>
 
</pre>
  
 
<pre>
 
<pre>
>>> print("""In 2009,
+
>>> print """In 2009,
 
...    The monetary component of the Nobel Prize
 
...    The monetary component of the Nobel Prize
...        was US $1.4 million.""")
+
...        was US $1.4 million."""
 
In 2009,
 
In 2009,
 
     The monetary component of the Nobel Prize
 
     The monetary component of the Nobel Prize
Line 135: Line 135:
 
temperature = 32
 
temperature = 32
 
if temperature > 60 and temperature < 75:
 
if temperature > 60 and temperature < 75:
     print("It's nice and cozy in here!")
+
     print "It's nice and cozy in here!"
 
else:
 
else:
     print("Too extreme for me.")
+
     print "Too extreme for me."
 
</pre>
 
</pre>
  
Line 304: Line 304:
 
>>> your_dict.get("Eve")
 
>>> your_dict.get("Eve")
 
>>> person = your_dict.get("Eve")
 
>>> person = your_dict.get("Eve")
>>> print(person)
+
>>> print person
 
None
 
None
>>> print(type(person))
+
>>> print type(person)
 
<type 'NoneType'>
 
<type 'NoneType'>
 
>>> your_dict.get("Alice")
 
>>> your_dict.get("Alice")

Please note that all contributions to OpenHatch wiki are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) (see OpenHatch wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)