
코딩을 배우는 가장 좋은 방법은 **직접 프로젝트를 만들어 보는 것**입니다. 이 글에서는 **비전공자도 쉽게 따라 할 수 있는 5가지 코딩 프로젝트**를 소개합니다.
1. 간단한 계산기 만들기 (Python)
기초 프로그래밍 개념을 익히기에 좋은 프로젝트입니다.
# 덧셈, 뺄셈, 곱셈, 나눗셈이 가능한 계산기
def calculator():
num1 = float(input("첫 번째 숫자 입력: "))
operator = input("연산자 입력 (+, -, *, /): ")
num2 = float(input("두 번째 숫자 입력: "))
if operator == '+':
print("결과:", num1 + num2)
elif operator == '-':
print("결과:", num1 - num2)
elif operator == '*':
print("결과:", num1 * num2)
elif operator == '/':
print("결과:", num1 / num2)
else:
print("잘못된 연산자입니다.")
calculator()
Python의 **input(), if-else 조건문, 함수**를 활용하는 연습이 됩니다.
2. 나만의 블로그 만들기 (HTML & CSS)
HTML과 CSS를 배웠다면, 간단한 블로그 페이지를 만들어 보세요.
<!DOCTYPE html>
<html>
<head>
<title>내 블로그</title>
<style>
body { font-family: Arial; text-align: center; background-color: #f4f4f4; }
h1 { color: #333366; }
p { color: #555; }
</style>
</head>
<body>
<h1>내 첫 번째 블로그</h1>
<p>HTML과 CSS를 사용해 만든 나만의 공간!</p>
</body>
</html>
이 프로젝트를 발전시켜 **자기소개 페이지**나 **포트폴리오 웹사이트**로 확장할 수도 있습니다.
3. 할 일(To-Do) 목록 만들기 (JavaScript)
JavaScript를 활용하여 동적인 기능을 추가해보세요.
<!DOCTYPE html>
<html>
<head>
<title>To-Do List</title>
</head>
<body>
<h2>할 일 목록</h2>
<input type="text" id="task" placeholder="할 일 입력">
<button onclick="addTask()">추가</button>
<ul id="taskList"></ul>
<script>
function addTask() {
let taskValue = document.getElementById("task").value;
if (taskValue !== "") {
let li = document.createElement("li");
li.textContent = taskValue;
document.getElementById("taskList").appendChild(li);
document.getElementById("task").value = "";
}
}
</script>
</body>
</html>
이 프로젝트를 통해 **DOM 조작, 이벤트 처리** 등을 연습할 수 있습니다.
4. 랜덤 숫자 맞추기 게임 (Python)
간단한 게임을 만들어 Python의 **반복문, 조건문, 랜덤 함수**를 연습해 보세요.
import random
def number_guessing_game():
target = random.randint(1, 100)
guess = 0
while guess != target:
guess = int(input("1부터 100 사이의 숫자를 맞춰보세요: "))
if guess > target:
print("너무 큽니다!")
elif guess < target:
print("너무 작습니다!")
else:
print("정답입니다!")
number_guessing_game()
이 게임을 더 발전시켜 **점수 시스템**을 추가해 볼 수도 있습니다.
5. 간단한 날씨 앱 만들기 (JavaScript & API 활용)
오픈 API를 활용해 **실시간 날씨 정보**를 가져오는 프로젝트입니다.
<!DOCTYPE html>
<html>
<head>
<title>날씨 확인하기</title>
</head>
<body>
<h2>현재 날씨 조회</h2>
<button onclick="getWeather()">날씨 확인</button>
<p id="weather"></p>
<script>
async function getWeather() {
let response = await fetch("https://api.open-meteo.com/v1/forecast?latitude=37.5665&longitude=126.9780¤t_weather=true");
let data = await response.json();
document.getElementById("weather").innerText = "현재 온도: " + data.current_weather.temperature + "°C";
}
</script>
</body>
</html>
오픈 API를 사용해 데이터를 가져오는 방법을 배울 수 있습니다.
결론
위 5가지 프로젝트를 하나씩 따라 하면서 실력을 키워보세요! 간단한 프로젝트부터 시작해 점점 발전시켜 나가면 어느새 실력이 쌓이게 됩니다.
다음 글에서는 "코딩 초보자가 자주 하는 실수 & 해결 방법"을 소개하겠습니다!