K

@kimjuha19

비싼 물건 개수

Python
5 months ago
prices = [3000, 7000, 2000, 10000] count = 0 for i in range(len(prices)): if prices[i] > 5000: count += 1 print(count)

최대 수익 찾기

Python
5 months ago
sales = [150, 300, 250, 400, 350] max_sale = 0 for i in range(len(sales)): if sales[i] > max_sale: max_sale = sales[i] print(max_sale)

심야 할증 요금

Python
5 months ago
hour = 1 distance_fee = 5000 start_pay = 4000 pay = 0 if hour >= 0 and hour <= 4: pay = (start_pay + distance_fee) * 12 // 10 else: pay = (start_pay + distance_fee)

전력 요금 계산

Python
5 months ago
usage = 250 pay = 0 total = usage - 200 if usage <= 200: pay += (usage * 100) else: usage -= total pay += (usage * 100) pay += (total * 200)

성적 장학금

Python
5 months ago
avg_score = 92 if avg_score >= 95: print("전액") elif avg_score < 95 and avg_score >= 90: print("반액") else: print("없음")

윤년 판별

Python
5 months ago
year = 2024 if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0: print("윤년") else: print("윤년이 아닙니다")

시험 합격 기준

Python
5 months ago
scores = [80, 35, 90] fail = 40 total = 0 for i in range(len(scores)): total += scores[i] if scores[i] < fail: print("Fail") break total = total // len(scores)

로그인 유효성 검사

Python
5 months ago
id = "admin" pw = "1111" answer = True add_id = "admin" add_pw = "p123" if id == add_id and pw == add_pw: answer = True else: answer = False

배달 요금 차등제

Python
5 months ago
order = 15000 answer = order if order >= 30000: answer += 0 elif order >= 10000 and order < 30000: answer += 2000 else: answer += 4000

온도 경보 시스템

Python
5 months ago
temps = [32, 15, -5] answer = [] for i in range(0,len(temps)): if temps[i] >= 30: answer.append("폭염") elif temps[i] <= 0: answer.append("한파") else: answer.append("정상")

놀이공원 자유이용권

Python
5 months ago
age = 70 pay = 40000 answer = pay if age < 13 or age >= 65: answer = answer // 2 print(answer)

복합 할인 적용

Python
5 months ago
count = 12 pay = 10000 answer = count * pay if count >= 10: answer = answer * 80 // 100 elif count >= 5: answer = answer * 90 // 100

은행 계좌 트랜잭션 처리

Python
5 months ago
def process_transactions(balance, logs): for i in range(len(logs)): if logs[i][0] == "in": balance += logs[i][1] elif logs[i][0] == "out": if logs[i][1] > balance: balance -= 0

괄호 깊이(Depth) 측정

Python
5 months ago
def get_max_depth(string): max_depth = 0 current = 0 for char in string: if char == "(": current += 1 if current > max_depth: max_depth = current elif char == ")":

연속된 숫자 그룹화

Python
5 months ago
def group_consecutive(nums): if not nums: return [] nums.sort() result = [] start = end = nums[0] for num in nums[1:]: if num == end + 1:

JSON 형식 데이터 파싱

Python
5 months ago
def string_to_dict(raw_data): items = raw_data.split(",") result = {} for item in items: key, value = item.split(":") result[key] = value return result raw_data = "id:101,name:python,level:gold"

로그 파일 분석

Python
5 months ago
def get_failure_rate(n, stages): failure = [] total_players = len(stages) for stage in range(1, n + 1): fail_count = stages.count(stage) if total_players == 0: fail_rate = 0 else: fail

회의실 예약 충돌 확인

Python
5 months ago
def is_conflict(existing_reservations, new_reservation): new_start, new_end = new_reservation for exist_start, exist_end in existing_reservations: if new_start < exist_end and new_end > exist_start: return True

소인수분해 함수

Python
5 months ago
def get_prime_factors(n): factors = [] divisor = 2 while n > 1: if n % divisor == 0: factors.append(divisor) n //= divisor else: divisor += 1

성적 장학금 대상자 추출

Python
5 months ago
def get_scholars(student_list): qualified = [] for student in student_list: avg_score = sum(student["score"]) / len(student["score"]) if avg_score >= 90 and student["volunteer"] >= 80: qualified.append((student["n