In [1]:
64**2
Out[1]:
In [2]:
64**0.5
Out[2]:
In [3]:
0.1+0.2-0.3
Out[3]:
In [8]:
0.100000000+0.20000000-0.30000000000
Out[8]:
In [9]:
print "Hello world"
In [10]:
print 'jello\nworld'
In [11]:
print("jello")
In [12]:
print(' "this is a quote" ')
In [13]:
'hello world'
'hello jello'
Out[13]:
In [14]:
len('hello')
Out[14]:
In [15]:
s = 'jello world'
In [16]:
s
Out[16]:
In [17]:
print(s)
In [18]:
s[0]
Out[18]:
In [20]:
s[0..2]
In [21]:
s[1:]
Out[21]:
In [22]:
s[:4]
Out[22]:
In [23]:
s[:-4]
Out[23]:
In [24]:
s[::3]
Out[24]:
In [25]:
s[-1:-3]
Out[25]:
In [26]:
s[:4:2]
Out[26]:
In [27]:
s[::-1]
Out[27]:
In [29]:
s[1:-1]
Out[29]:
In [30]:
s[::-1][::-1]
Out[30]:
In [31]:
s[0]
Out[31]:
In [32]:
s[0] = "H"
In [33]:
s = "Sjup"
In [34]:
s
Out[34]:
In [35]:
s + "Hello world"
Out[35]:
In [37]:
s.upper()
Out[37]:
In [38]:
s.expand()
In [39]:
s.split()
Out[39]:
In [40]:
s = "Hello world"
In [41]:
s.split("e")
Out[41]:
In [43]:
"string with {}".format("value")
Out[43]:
In [44]:
s = 'String'
In [45]:
print 'Place my variable here: %s' %(s)
In [46]:
world = 'World'
In [50]:
print 'Hello, %s. I am %s' % (s, "louis")
In [51]:
print 'Floating point: %1.2f' % (12.3123)
In [53]:
print 'Hello, {x}. I am {y}. {x}'.format(x='world', y='louis')
In [54]:
from __future__ import print_function
In [55]:
print('hello {x}'.format(x="insert"))
In [ ]: