Colab

1+1

2
10*10

100
2**8

256
'hi my name is:'

'hi my name is:'
'hi my name is:' + ' aviad'

'hi my name is: aviad'
print("hello world")

hello world
"hello world".upper()

'HELLO WORLD'
"hello world".upper().title()

'Hello World'
"hello world".upper

<function str.upper>
"hello world".upper.__name__

'upper'
dir("hello")

['__add__',
 '__class__',
 '__contains__',
 '__delattr__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__getitem__',
 '__getnewargs__',
 '__gt__',
 '__hash__',
 '__init__',
 '__init_subclass__',
 '__iter__',
 '__le__',
 '__len__',
 '__lt__',
 '__mod__',
 '__mul__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__rmod__',
 '__rmul__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 'capitalize',
 'casefold',
 'center',
 'count',
 'encode',
 'endswith',
 'expandtabs',
 'find',
 'format',
 'format_map',
 'index',
 'isalnum',
 'isalpha',
 'isdecimal',
 'isdigit',
 'isidentifier',
 'islower',
 'isnumeric',
 'isprintable',
 'isspace',
 'istitle',
 'isupper',
 'join',
 'ljust',
 'lower',
 'lstrip',
 'maketrans',
 'partition',
 'replace',
 'rfind',
 'rindex',
 'rjust',
 'rpartition',
 'rsplit',
 'rstrip',
 'split',
 'splitlines',
 'startswith',
 'strip',
 'swapcase',
 'title',
 'translate',
 'upper',
 'zfill']
help("helllo".upper)

Help on built-in function upper:

upper(...) method of builtins.str instance
    S.upper() -> str
    
    Return a copy of S converted to uppercase.

"the quick brown fox jumped over the lazy dog".split()

['the', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy', 'dog']
[1, 2, 3]

[1, 2, 3]
[1, "one", [4, 5, 6]]

[1, 'one', [4, 5, 6]]
[[[[[1]]]]]

[[[[[1]]]]]
print(1 + 1)


2
1+1

2
1+1
10+10
"my" + " name"

'my name'
[1, 2, 3 ]

[1, 2, 3]
{ "Avi" : "053-424", "Ben" : "055-234", "Can" : "054-235235"}

{'Avi': '053-424', 'Ben': '055-234', 'Can': '054-235235'}
x = { "Avi" : "053-424", "Ben" : "055-234", "Can" : "054-235235"}

x

{'Avi': '053-424', 'Ben': '055-234', 'Can': '054-235235'}
x['Avi']

'053-424'
x['avram']


    ---------------------------------------------------------------------------

    KeyError                                  Traceback (most recent call last)

    <ipython-input-26-21bf891dd163> in <module>
    ----> 1 x['avram']
    

    KeyError: 'avram'


x['avram'] = "054-124"

x

{'Avi': '053-424', 'Ben': '055-234', 'Can': '054-235235', 'avram': '054-124'}
x.keys()

dict_keys(['Avi', 'Ben', 'Can', 'avram'])
x.values()

dict_values(['053-424', '055-234', '054-235235', '054-124'])
x.items()

dict_items([('Avi', '053-424'), ('Ben', '055-234'), ('Can', '054-235235'), ('avram', '054-124')])
y = [1, 2, 3 ]


y

[1, 2, 3]
a = 10

b = 10

a+b

20
a = "hello"

a

'hello'
type(10)

int
type("one")

str
type(a)

str
type(b)

int
print
dir
help
type

type
len("hello world")

11
len([1, 2, 3])

3
x = [1, 2 , 3, "four"]

x[0]

1
x[1]

2
x[-1]

'four'
x[len(x) - 1]

'four'
x[-1]

'four'
x[-2]

3
x[-3]

2
x[-10]


    ---------------------------------------------------------------------------

    IndexError                                Traceback (most recent call last)

    <ipython-input-54-1bcdf43c1a76> in <module>
    ----> 1 x[-10]
    

    IndexError: list index out of range


x[10]


    ---------------------------------------------------------------------------

    IndexError                                Traceback (most recent call last)

    <ipython-input-55-0bcbedae9f7e> in <module>
    ----> 1 x[10]
    

    IndexError: list index out of range