반응형
정수(Integers)
x = 14
print(x)
print(type(x))
결과: 14
<class 'int'>
실수(Floats)
nearly_pi = 3.141592653589793238462643383279502884197169399375105820974944
print(nearly_pi)
print(type(nearly_pi))
결과: 3.141592653589793
<class 'float'>
불린(Booleans): 참, 거짓
z_one = True
print(z_one)
print(type(z_one))
결과:True
<class 'bool'>
z_three = (1 < 2)
print(z_three)
print(type(z_three))
결과: True
<class 'bool'>
z_five = not z_three
print(z_five)
print(type(z_five))
결과: False
<class 'bool'>
텍스트(Strings)
w = "Hello, Python!"
print(w)
print(type(w))
결과: Hello, Python!
<class 'str'>
print(len(w))
결과: 14
shortest_string = ""
print(type(shortest_string))
print(len(shortest_string))
결과: <class 'str'>
0
my_number = "1.12321"
print(my_number)
print(type(my_number))
결과: 1.12321
<class 'str'>
also_my_number = float(my_number)
print(also_my_number)
print(type(also_my_number))
결과: 1.12321
<class 'float'>
new_string = "abc" + "def"
print(new_string)
print(type(new_string))
결과: abcdef
<class 'str'>
<< 참조 >>
https://www.kaggle.com/code/alexisbcook/data-types
Data Types
Explore and run machine learning code with Kaggle Notebooks | Using data from No attached data sources
www.kaggle.com
반응형
'프로그램 개발해서 돈벌기 > AI' 카테고리의 다른 글
파이션(python) 초등 완전 기초: 리스트 (Lists) (0) | 2023.02.12 |
---|---|
파이션(python) 초등 완전 기초: 조건문(Conditions and Conditional Statements) (0) | 2023.02.10 |
파이션(python) 초등 완전 기초: 함수(Function) (0) | 2023.02.09 |
파이션(python) 초등 완전 기초: 연산과 변수 (0) | 2023.02.07 |
ChatGPT 개념과 사용법(API 샘플 코드 포함) (0) | 2023.02.06 |
댓글