본문 바로가기

IT 세계의 후아

검색하기
IT 세계의 후아
프로필사진 후__아

  • 전체 (55)
    • Coding (43)
      • Python (27)
      • Study (15)
      • Algorithm (1)
    • Recording (12)
      • NewsScrap (10)
      • 취준기록 (0)
      • Etc (2)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
일 월 화 수 목 금 토
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
Tags
  • 리스트
  • 파이썬
  • 경제신문스크랩
  • langchain
  • 백준
  • 문자열
  • rag
  • Python
  • dict
  • 생성형AI
  • llm
  • 이중리스트
  • AI
  • 랭체인
  • chr
  • OpenAI
  • 프로그래머스
  • Ord
  • 데이콘경진대회
  • listcomprehension
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록listcomprehension (1)

IT 세계의 후아

[python]list comprehension, if-elif-else

※ list comprehension으로 다중 if문 쓰기for i in list:  if 조건A:     print("a")  elif 조건B:     print("b")  else:     print("c")≫ print(["a" if 조건A else "b" if 조건B else "c" for i in list]) # 프로그래머스 lv0 qr code# 초반 풀이def solution(q, r, code): return code[r-1::q] if r>0 else code[r::q-1] # ValueError: slice step cannot be zero # q=1, r=0일 때 오류! # 수정 후 return code[r::q] if r>0 else code if q..

Coding/Python 2024. 4. 24. 00:41
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바