Skip to content

Python Basic

GitDeveloperKim edited this page Apr 16, 2022 · 15 revisions

input

  • input().split()

map

  • input 값이 10 20 30 40 50 일 때
  • x = list(map(int, input().split()))

주석 달기

  • '#' 주석 내용
  • ''' 여러줄의 주석 내용 '''

연산자

  • / : floating 몫 리턴
  • // : int 몫 리턴
  • if 0 <= english <= 100 :

리스트 표현식 사용하기

리스트 안에 식, for반복문, if 조건문 등을 지정하여 리스트를 생성하는 것을 list comprehension 이라고 한다
for와 if를 여러번 사용할 수도 있습니다.

  • [식 for 변수 in 리스트 if 조건식]
  • list(식 for 변수 in 리스트 if 조건식)
Clone this wiki locally