Colab

x = 10
yyyyyyy = 10
______xyz123 = 10
my_name_is = "aviad"

name!


      File "<ipython-input-2-7e2edb9704ba>", line 1
        name!
            ^
    SyntaxError: invalid syntax



my name is = "aviad"


      File "<ipython-input-3-11369b3a526d>", line 1
        my name is = "aviad"
              ^
    SyntaxError: invalid syntax



ThisIsAVariable = 123

m1000 = 1

___ = 10

x = 10
X = 100

x

10
X

100
xX


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

    NameError                                 Traceback (most recent call last)

    <ipython-input-10-de12b573e30b> in <module>
    ----> 1 xX
    

    NameError: name 'xX' is not defined


_ =1
__ =2 
___ = 3

_

1
___

3
x = 10

type(x)

int
x = "aviad"

type(x)

str
#"the quick brown fox jumped over the lazy dog".split(' ')
"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]
type([1,2,3])

list
sentence = "the quick brown fox jumped over the lazy dog"
words = sentence.split()
words

['the', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy', 'dog']
len(words)

9
len(sentence)

44
len([1,2,3])

3
[dog, cat, fox]


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

    NameError                                 Traceback (most recent call last)

    <ipython-input-28-b91641418ab0> in <module>
    ----> 1 [dog, cat, fox]
    

    NameError: name 'dog' is not defined


[]

[]
["hello"]

['hello']
["hello", 10, 0.5]

['hello', 10, 0.5]
len(["hello", 10, 0.5])

3
len(["hello",                            10,0.5])

3
[1+1+1,10+90, "hello" + " goobye"]

[3, 100, 'hello goobye']
["blue dogs", "green cats"]

['blue dogs', 'green cats']
["1 2 3"]

['1 2 3']
stuff =[ [1,2,3], ["a", "b", "c", [1,2,3] ] ]

len(stuff)

2
words = "oops I did it again".split()
words

['oops', 'I', 'did', 'it', 'again']
words[0]

'oops'
words[1]

'I'
words[2]

'did'
words[3]

'it'
words[4]

'again'
words[5]


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

    IndexError                                Traceback (most recent call last)

    <ipython-input-51-f6a2fb6dbef1> in <module>
    ----> 1 words[5]
    

    IndexError: list index out of range


sentence

'the quick brown fox jumped over the lazy dog'
sentence[0]

't'
[1,2,3] + ["a", "b", "c"]

[1, 2, 3, 'a', 'b', 'c']
x = [1,2,3]
y = ["a", "b", "c"]

y+x

['a', 'b', 'c', 1, 2, 3]
x+y+x

[1, 2, 3, 'a', 'b', 'c', 1, 2, 3]
[ x[0] ] + [y[0]] + [x[1]] + [y[1]]

[1, 'a', 2, 'b']
[x[0], y[0], x[1], y[1] ]

[1, 'a', 2, 'b']
x[0] + x[1]

3
words = sentence.split(' ')
words

['the', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy', 'dog']
words[2] = "green"
words

['the', 'quick', 'green', 'fox', 'jumped', 'over', 'the', 'lazy', 'dog']
" ".join(words)

'the quick green fox jumped over the lazy dog'
"".join(words)

'thequickgreenfoxjumpedoverthelazydog'
"   ".join(words)

'the   quick   green   fox   jumped   over   the   lazy   dog'
"@|!".join(words)

'the@|!quick@|!green@|!fox@|!jumped@|!over@|!the@|!lazy@|!dog'
",".join(["moshe", "1000", "1/1/2011"])

'moshe,1000,1/1/2011'
'moshe,1000,1/1/2011'.split(',')

['moshe', '1000', '1/1/2011']
words

['the', 'quick', 'green', 'fox', 'jumped', 'over', 'the', 'lazy', 'dog']
type(words)

list
type(words[0])

str
words[0][0]

't'
words[0]

'the'