1.Escape sequence(확장 문자열, 특정 기능을 하는 문자)

print("Hello, \nWorld!") #\n = Enter 

print("Hello, \tWorld!") #\t = tap

print(".........\\never...")#\\ = to print "\"(back slash)

print("He said, \"Hello.\"") #\" = to print double quotation

 

2.Boolean(Logical data type)

#Data that indicates true and false situations

a = True

b = False

 

if True:

    print("It's True")#space 4times

else:

    print("It's False")

 

if False:

    print("It's False")

else:

    print("It's True")

 

3. Type Casting(conversion)

is converting one data type into another one.

 

1)int()  #converting some data type into int type 

str_to_int = int("123")

print(str_to_int, type(str_to_int)) #123 <class 'int'>

 

float_to_int = int(123.4)

print(float_to_int, type(float_to_int)) #123 <class 'int'>

 

2)float() #converting some data type into float type

str_to_float = float("123.4")

print(str_to_float, type(str_to_float)) #123.4 <class 'float'>

 

int_to_float = float(123)

print(int_to_float, type(int_to_float)) #123.0 <class 'float'>

 

3) str() #converting some data type into string type

int_to_str = str(123)

print(int_to_str, type(int_to_str)) #123 <class 'str'>

 

float_to_str = str(123.4)

print(float_to_str, type(float_to_str)) #123.4 <class 'str'>

 

4) bool() #converting some data type into boolean type

print(bool(0)) # 0, 0.0, " " => False, else => True

 

#input type casting

a = input("Please type number : ")

print("The number * 10 = ", result * 10)

print(type(a))

print("==================")

 

b = input("Please type number : ")

print("The number * 10 = ", int(b) * 10) # str -> int

print(type(b)) #BUT, the type is str not int, WHY?

print("==================")

 

c = int(a)

print(c, type(c))

print("==================")

 

d = float(a)

print(d, type(d))

 

 

#Practice

Get 3 numbers from the user.

Save Variables, n1, n2, n3

Calculate

    n1 * n2 = ?

    n1 * n2 / n3 = ?

Print the results.