문제
환자 코드의 마지막 4글자에 따라 병과가 정해진다.
마지막 글자 | 병과 |
"_eye" | "Ophthalmologyc" |
"head" | "Neurosurgery" |
"infl" | "Orthopedics" |
"skin" | "Dermatology" |
# 빈칸 채우기 문제
code = input()
last_four_words = code[-4:]
if last_four_words == [ ]:
print("Ophthalmologyc")
elif [ ]:
print("Neurosurgery")
elif [ ]:
print("Orthopedics")
[ ]:
print("Dermatology")
[ ]:
print("direct recommendation")
코드
code = input()
last_four_words = code[-4:]
if last_four_words == "_eye":
print("Ophthalmologyc")
elif last_four_words == "head":
print("Neurosurgery")
elif last_four_words == "infl":
print("Orthopedics")
elif last_four_words == "skin":
print("Dermatology")
else:
print("direct recommendation")
'프로그래머스 > Python' 카테고리의 다른 글
[프로그래머스] PCCE 기출문제 - 1번 / 출력 (Python) (0) | 2025.01.21 |
---|---|
[프로그래머스] PCCE 기출문제 - 5번 / 심폐소생술 (Python) (0) | 2025.01.21 |
[프로그래머스] PCCE 기출문제 - 3번 / 수 나누기 (Python) (0) | 2025.01.21 |
[프로그래머스] PCCE 기출문제 - 2번 / 각도 합치기 (Python) (0) | 2025.01.21 |
[프로그래머스] PCCE 기출문제 - 1번 / 문자 출력 (Python) (0) | 2025.01.21 |