tutorial0 basetype



In [2]:
1


Out[2]:
1

In [3]:
2*3


Out[3]:
6

In [4]:
1==0


Out[4]:
False

In [6]:
not 1==0


Out[6]:
True

In [12]:
(2==2) and (2==3)


Out[12]:
False

In [14]:
(2==2) or (2==3)


Out[14]:
True

In [15]:
'artificial' + "intelligence"


Out[15]:
'artificialintelligence'

In [16]:
'artificial'.upper()


Out[16]:
'ARTIFICIAL'

In [17]:
'HELP'.lower()


Out[17]:
'help'

In [18]:
len('Help')


Out[18]:
4

In [19]:
s = 'hello world' 
print s


hello world

In [20]:
s.upper()


Out[20]:
'HELLO WORLD'

In [21]:
len(s.upper())


Out[21]:
11

In [23]:
num = 8.0
num += 2.5
print num


10.5

In [27]:
s='abc'

In [28]:
dir(s)


Out[28]:
['__add__',
 '__class__',
 '__contains__',
 '__delattr__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__getitem__',
 '__getnewargs__',
 '__getslice__',
 '__gt__',
 '__hash__',
 '__init__',
 '__le__',
 '__len__',
 '__lt__',
 '__mod__',
 '__mul__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__rmod__',
 '__rmul__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '_formatter_field_name_split',
 '_formatter_parser',
 'capitalize',
 'center',
 'count',
 'decode',
 'encode',
 'endswith',
 'expandtabs',
 'find',
 'format',
 'index',
 'isalnum',
 'isalpha',
 'isdigit',
 'islower',
 'isspace',
 'istitle',
 'isupper',
 'join',
 'ljust',
 'lower',
 'lstrip',
 'partition',
 'replace',
 'rfind',
 'rindex',
 'rjust',
 'rpartition',
 'rsplit',
 'rstrip',
 'split',
 'splitlines',
 'startswith',
 'strip',
 'swapcase',
 'title',
 'translate',
 'upper',
 'zfill']

In [26]:
help(s.find)


Help on built-in function find:

find(...)
    S.find(sub [,start [,end]]) -> int
    
    Return the lowest index in S where substring sub is found,
    such that sub is contained within S[start:end].  Optional
    arguments start and end are interpreted as in slice notation.
    
    Return -1 on failure.

In [30]:
s.find('b')


Out[30]:
1

In [ ]: