Guest User

Untitled

a guest
Jan 9th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. # 데이터 타입 종류
  2. - 부울
  3. - 정수
  4. - 실수
  5. - 문자열
  6.  
  7. ## 변수 타입 확인
  8.  
  9. ```python
  10. type(variable_name)
  11. type(58)
  12. type(29.9)
  13. type('float')
  14. ```
  15.  
  16. ## 예약어
  17.  
  18. - False
  19. - None
  20. - True
  21. - and
  22. - as
  23. - assert
  24. - break
  25. - class
  26. - continue
  27. - def
  28. - del
  29. - elif
  30. - else
  31. - except
  32. - finally
  33. - for
  34. - from
  35. - global
  36. - if
  37. - import
  38. - in
  39. - is
  40. - lambda
  41. - nonlocal
  42. - not
  43. - or
  44. - pass
  45. - raise
  46. - return
  47. - try
  48. - while
  49. - with
  50. - yield
  51.  
  52. ## 숫자
  53. 파이썬의 숫자 데이터는 정수와 부동소수점이 있다.
  54.  
  55.  
  56. 연산자|설명
  57. ---|---
  58. +|더하기
  59. -|빼기
  60. *|곱하기
  61. /|부동소수점
  62. //|정수 나누기(소수점 이하 버림)
  63. %|나머지
  64. **|지수
  65.  
  66. ### 진수
  67. - 2진수(binary): 0b 혹은 0B
  68. - 8진수(octal): 0o 혹은 oO
  69. - 16진수(hex): 0x 혹은 0X
  70.  
  71. ### 형변환
  72. ```python
  73. int(True) # 1
  74. int(False) # 0
  75. int(98.6) # 98
  76. int(1.0e4) # 10000
  77. int('99') # 99
  78. int('-23') # -23
  79. int('+12') # 12
  80. int('99 bottles') # error
  81. int('98.6') # error
  82. int('1.0e4') # error
  83. ```
  84.  
  85. ### 부동소수점수
  86. ```python
  87. flaot(True) # 1.0
  88. float(False) # 0.0
  89. float(98) # 98.0
  90. float('99') # 99.0
  91. float('98.6') # 98.6
  92. float('-1.5') # -1.5
  93. float('1.0e4') # 10000.0
  94. ```
Add Comment
Please, Sign In to add comment