'목록하단 광고 치환자(withSeok)
728x90
A100
# 언더바(_)를 이용한 숫자 표현

# 1000000=1_000_000
print(1_000_000+5)
print()

print(0b_10_10) # 1010(2) = 1*2^3 + 1*2 = 8+2=10

print(0.001_002_003)

 

 

A101
# 복소수 표현 
# 허수부에 j 또는 J를 사용

a = 1+5j
b = 3+11J
print(a)
print(b)
print()

print(a+b)
print(a-b)
print()

type(a)

 

 

A102
c = 2+1j
d = 1+1j
print(c-d)
print(type(c-d))
print()

# 정수와 복소수 변수의 값이 같을 때
e=1
print(e==c-d)
type(e)

 

 

A103
# 허수부와 실수부 얻기
a = 3+5j
print(a.real) #실수부 얻기
print(a.imag) #허수부 얻기

 

 

A104
# 큰 따옴표와 작은 따옴표 출력

print("I'm a boy.") #서로 교차하여 표현
print('I"m a boy.')
print()

print('I\'m a boy.') # 큰 따옴표 안에 큰 따온표 사용 
                    # 특수기호 \뒤에 특수문자 넣으면 됨.

 

 

A105
# 줄바꿈
a = "줄을 바꾸어 계속 \
입력할수 있을까?" # 특수문자 \를 활용
print(a)

print()
print("줄을 바꾸어 또다시 \
계속 입력 가능하네....")

print()
print("여러 줄도 \
 가능?  \
   앞에 몇 칸도 글자?....")

 

 

A106
age=21
print("happy"+" birthday")

# "happy"+age+" birthday"
# 문자와 숫자는 더하기 연산 불가

print()
print("happy "+str(age)+" birthday") 

print()
a = None # 첫글자 대문자 N
print(a)
type(a)

 

 

728x90

+ Recent posts