본문 바로가기

전체 글297

[프로그래머스] 코딩 기초 트레이닝 - 주사위 게임 2(파이썬) def solution(a, b, c): if a == b and b == c: return (a + b + c) * (a**2 + b**2 + c**2 ) * (a**3 + b**3 + c**3 ) elif a != b and b != c and a != c: return a + b + c else: return (a + b + c) * (a**2 + b**2 + c**2 ) https://school.programmers.co.kr/learn/courses/30/lessons/181930 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 2023. 6. 7.
[프로그래머스] 코딩 기초 트레이닝 - 등차수열의 특정한 항만 더하기(파이썬) def solution(a, d, included): answer = 0 for i in range(len(included)): answer += (a + d * i) * int(included[i]) return answer https://school.programmers.co.kr/learn/courses/30/lessons/181931?language=python3 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 2023. 6. 7.
[프로그래머스] 코딩 기초 트레이닝 - 코드 처리하기(파이썬) def solution(code): answer = '' mode = 0 for i in range(len(code)): if code[i] == '1': mode ^= 1 else: if i % 2 == mode: answer += code[i] return answer if answer else 'EMPTY' https://school.programmers.co.kr/learn/courses/30/lessons/181932 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 2023. 6. 7.
[프로그래머스] 코딩 기초 트레이닝 - flag에 따라 다른 값 반환하기(파이썬) def solution(a, b, flag): if flag: return a + b else: return a - b https://school.programmers.co.kr/learn/courses/30/lessons/181933 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 2023. 6. 6.
[프로그래머스] 코딩 기초 트레이닝 - 조건 문자열(파이썬) def solution(ineq, eq, n, m): if ineq == ">" and eq == "=" and n >= m: return 1 elif ineq == "" and eq == "!" and n > m: return 1 elif ineq == " 2023. 6. 6.
[프로그래머스] 코딩 기초 트레이닝 - 홀짝에 따라 다른 값 반환하기(파이썬) def solution(n): if n % 2 == 1: # n이 홀수인 경우 return sum(range(1, n+1, 2)) else: # n이 짝수인 경우 return sum([i**2 for i in range(2, n+1, 2)]) https://school.programmers.co.kr/learn/courses/30/lessons/18193 2023. 6. 6.