사진찍는 개발자📸👩‍💻
close
프로필 배경
프로필 로고

사진찍는 개발자📸👩‍💻

  • 분류 전체보기 (121)
    • develop (120)
      • PHP (5)
      • Python (73)
      • Back-End Roadmap (1)
      • AWS (36)
      • Java (0)
      • Nest.js (5)
    • interest (1)
      • 35mm film (1)
  • 홈
  • 태그
  • 방명록

[프로그래머스/파이썬] 외계행성의 나이

def solution(age): a = {'0': 'a', '1':'b', '2':'c', '3':'d', '4':'e', '5':'f', '6':'g', '7':'h', '8':'i', '9':'j'} return "".join([a[i] for i in str(age)]) 숫자를 치환할 수 있는 object를 a로 선언하고 age를 문자열로 변환한 뒤 for문을 돌려 a에 있는 값으로 출력하게 하였다. 이를 join하여 다시 문자열 형태로 반환하면 끝~!

  • format_list_bulleted develop/Python
  • · 2023. 3. 2.
  • textsms

[프로그래머스/파이썬] 인덱스 바꾸기

def solution(my_string, num1, num2): arr = list(my_string) arr[num1], arr[num2] = arr[num2], arr[num1] return "".join(arr) my_string을 배열 형태로 바꾸고, arr[num1] 에 arr[num2]의 값을, arr[num2] 에 arr[num1]의 값을 선언한다. arr를 join 하여 문자열 형태로 값을 리턴한다

  • format_list_bulleted develop/Python
  • · 2023. 3. 2.
  • textsms

[프로그래머스/파이썬] 문자열 정렬하기(2)

def solution(my_string): return "".join(sorted(my_string.lower())) [develop/Python] - [파이썬/Python] 정렬 함수 [develop/Python] - [파이썬/Python] 자료형 판별 함수

  • format_list_bulleted develop/Python
  • · 2023. 3. 2.
  • textsms

[프로그래머스/파이썬] 가장 큰 수 찾기

def solution(array): value = max(array) return [value, array.index(value)] array에서 가장 큰 값을 value로 저장 결과에 value와 array안의 value 값에 대한 인덱스를 찾기 위해 array.index(value)를 사용 [develop/Python] - [파이썬/Python] 문자열 관련 함수

  • format_list_bulleted develop/Python
  • · 2023. 2. 28.
  • textsms

[프로그래머스/파이썬] 7의 개수

def solution(array): return sum(str(i).count('7') for i in array) 배열의 값이 int 이기 때문에 array의 값인 i 를 str(i) 하여 string으로 변환 string.count(value) 함수를 사용하여 문자열 i 안에 '7' 이라는 글자가 몇개 있는지 계산 위의 값을 다 더하여 결과값 도출

  • format_list_bulleted develop/Python
  • · 2023. 2. 28.
  • textsms

[프로그래머스/파이썬] 잘라서 배열로 저장하기

def solution(my_str, n): answer = [] for i in range(0, len(my_str), n): answer.append(my_str[i:i+n]) return answer range(start, end, step) 함수를 이용하여 0번째에서 시작하고, my_str의 길이까지, n번째로 분할하는 range를 구하여 for문을 돌린다 value[start:end:step] 슬라이싱을 이용하여 시작값을 i, 끝 값을 i + n 의 인덱스를 가지는 문자열을 리턴하여 answer 배열에 입력한다

  • format_list_bulleted develop/Python
  • · 2023. 2. 28.
  • textsms
  • navigate_before
  • 1
  • ···
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • navigate_next
공지사항
전체 카테고리
  • 분류 전체보기 (121)
    • develop (120)
      • PHP (5)
      • Python (73)
      • Back-End Roadmap (1)
      • AWS (36)
      • Java (0)
      • Nest.js (5)
    • interest (1)
      • 35mm film (1)
최근 글
인기 글
최근 댓글
태그
  • #프로그래머스
  • #nest swagger 데코레이터
  • #파이썬
  • #SAA
  • #프로그래머스 파이썬
  • #aws
  • #SAA자격증
  • #nest swagger
  • #swagger 데코레이터
  • #Python
전체 방문자
오늘
어제
전체
Copyright © 쭈미로운 생활 All rights reserved.
Designed by JJuum

티스토리툴바