Python 정리/Python의 기본
변수 선언, print로 출력하기,숫자
아직미정임
2022. 3. 12. 20:32
변수 선언
num = 1
name = '1'
new_num = int(name)
print(new_num, type(new_num))
print 출력
print('hi')
#구분
print('Hi', 'Mike')
#Hi Mike
#space 가 아닌 다른 문자로 구분 짓고 싶을 때
print('Hi','Mike',sep=',')
#Hi,Mike
#end 정의 주로 \n(줄바꿈이 들어감)
print('Hi','Mike',sep=',', end='\n')
print('Hi','Mike',sep=',', end='\n')
#Hi,Mike
#Hi,Mike
print('Hi','Mike',sep=',', end='.\n')
#Hi,Mike.
숫자
#수학 함수
import math
result = math.sqrt(25)
print(result)
#5.0
y = math.log2(10) #밑이 2임
print(y)
#3.32192......
#math에 어떤 함수가 있는지 알고 싶을때는 document를 보면 된다
print(help(math))