본문 바로가기 메뉴 바로가기

programming study

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

programming study

검색하기 폼
  • 분류 전체보기 (120)
    • BOJ (77)
    • 자료구조 & 알고리즘 (8)
    • python (12)
    • spring boot (4)
    • java (2)
    • airbnb-clone - Django (16)
  • 방명록

divmod (1)
정수 다루기 - divmod, int 함수

📌 몫과 나머지 - divmod 정수를 나눈 몫과 나머지를 한번에 구해야 할 때 사용한다. // 연산자와 % 연산자를 이용하여 정수를 나눈 몫과 나머지를 구할 수 있다. print(a//b, a%b) 위의 코드를 divmod와 unpacking을 사용하여 아래와 같이 코드를 짤 수 있다. print(*divmod(a, b)) 작은 수를 다룰 때는 //와 %를 사용하는 것이 빠르지만, 큰 수를 다룰 때는 divmod 사용하는 것이 더 빠르다. 📌 n진법으로 표기된 string을 10진법 숫자로 변환하기 - int 함수 num과 base를 받아서 base 진법으로 표기된 num을 10진법 숫자로 출력하는 코드 작성 내가 쓴 코드 num, base = map(int, input().strip().split('..

python 2021. 3. 6. 21:59
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • postfix notation
  • 자료구조
  • for-else
  • 양방향 연결 리스트
  • Django
  • 선형 탐색
  • initBinder
  • sequence type
  • 직접 주입
  • 출력 형식 지정
  • 이진 탐색
  • ValidataionUtils
  • 의존 주입
  • djnago
  • most_common
  • 파이썬
  • 스택
  • springboot
  • python flag
  • 선형 배열
  • valid annotation
  • string module
  • Stack
  • ljust
  • python
  • tailwind
  • rjust
  • 스프링부트
  • airbnb clone
  • divmod
more
«   2026/04   »
일 월 화 수 목 금 토
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바