Colab

10

10
2+8

10
2+3*4

14
(2+3)*4

20
type(10)

int
type(1000*2 +4)

int
3.14

3.14
3/2

1.5
type(3/2)

float
10/3

3.3333333333333335
10 % 7

3
10 ** 2

100
"learning is fun"

'learning is fun'
type("learning is fun")

str
"EhRT Y$^&$ %$Y $YH RRWYTRT$&$U$@%$&4TRGJG rtTHR"

'ERWYTRT$&$U$@%$&4TRGJG rthRT Y$^&$ %$Y $YH RTHR'
"10 + 90"

'10 + 90'
type("10 + 90")

str
Y$^&$ %$Y $YH RRWYT


      File "<ipython-input-21-453405433204>", line 1
        Y$^&$ %$Y $YH RRWYT
         ^
    SyntaxError: invalid syntax



learning is fun


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

    NameError                                 Traceback (most recent call last)

    <ipython-input-22-c7c5f4e3d1ab> in <module>
    ----> 1 learning is fun
    

    NameError: name 'learning' is not defined


my_text = "learning is fun"

my_text

'learning is fun'
x = 10

x

10
my_text

'learning is fun'
my_text = "really fun"

my_text

'really fun'
x = 10 + 90

x

100
x = x + 50

x

150
my_text  = my_text + "!!!"

my_text

'really fun!!!'
1+1

2
"1" + "1"

'11'
"hello" + " " + "class"

'hello class'
"hello " * 3

'hello hello hello '
"1" + 9


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

    TypeError                                 Traceback (most recent call last)

    <ipython-input-40-68ab1afe3be8> in <module>
    ----> 1 "1" + 9
    

    TypeError: can only concatenate str (not "int") to str


s = "1"
x = 9
s+x


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

    TypeError                                 Traceback (most recent call last)

    <ipython-input-41-5ff27a2a48f4> in <module>
          1 s = "1"
          2 x = 9
    ----> 3 s+x
    

    TypeError: can only concatenate str (not "int") to str


"hello".upper()

'HELLO'
"hello class have a nice day".title()

'Hello Class Have A Nice Day'
"hello class have a nice day".startswith("nice")

False
type(False)

bool
True

True
"hello class have a nice day".startswith("hello class")

True
sentence = input("give me a sentence: ")
sentence.startswith("hello")

give me a sentence: bye bye
False
song = """
Yeah yeah yeah yeah yeah
Yeah yeah yeah yeah yeah yeah
I think I did it again
I made you believe we're more than just friends
Oh baby
"""

print(song)


Yeah yeah yeah yeah yeah
Yeah yeah yeah yeah yeah yeah
I think I did it again
I made you believe we're more than just friends
Oh baby

print(1,2,3,                  "hello")
print()
print(1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1)

1 2 3 hello

1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1
print("""
@
@@
@@@
@@@@
@@@@@
@@@@@@
@@@@@@@
""")


@
@@
@@@
@@@@
@@@@@
@@@@@@
@@@@@@@

for line_number in range(10)
    line = "@" * line_number
    print(line)

@@
@@@
@@@@
list(range(10))

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
len("hello")

5
len

<function len(obj, /)>
help(len)

Help on built-in function len in module builtins:

len(obj, /)
    Return the number of items in a container.