https://claude.ai/public/artifacts/ef202099-94dd-44b6-b1eb-fa7da9a5ed20
https://api.adviceslip.com/advice
api.adviceslip.com
뉴스 api 가져오기
https://newsapi.org/ 회원가입 후 뉴스 api 키 받고 실습 가능
News API – Search News and Blog Articles on the Web
“Ascender AI has a mission to apply AI to the media, and NewsAPI is one of our most valuable resources. Ascender is redefining how users interact with complex information, and the NewsAPI feed is an essential showcase for our technologies.” Braddock Ga
newsapi.org
https://newsapi.org/v2/everything
import requests
import json
from datetime import datetime
# 뉴스 가져오기
url = 'https://newsapi.org/v2/everything'
# 파라미터(매개변수)
params = {
"q" : "한국",
"language" : "ko",
"apikey" : "55ca631f1cbe4547a9c01b711179cf73"
}
response = requests.get(url, params = params)
print(response)
news_data = response.json()
print(news_data)

복습
복습 중에 만든 코드에서 에러(SyntaxError)가 발생했다.
이유는 class라는 변수명때문이다.
def game(name, level, class):
print(f"안녕하세요{name}님! {name}님의 레벨은 {level}이고 클래스는 {class}입니다.")
game("진환", 10, "마법사")
game("룰루", 15, "전사")
⛔️ [SyntaxError] 개념, 예시, 해결방법
⛔️ SyntaxError란?- 문법적인 에러를 뜻한다.# 🧩 SyntaxError란?`SyntaxError`는 **파이썬이 문법적으로 틀린 코드를 발견했을 때 발생하는 오류**를 뜻함. 즉, 파이썬이 “이 문장은 이해할 수 없다”고
honeypeach.tistory.com
class는 파이썬에서 이미 특별한 의미를 가진 단어(예약어, keyword)이기 때문이다.
즉, 파이썬은 class를 사용자가 만든 변수명으로 보지 않고, 클래스를 만들 때 쓰는 명령어로 인식한다.
변수명 수정 전)

변수명 수정 후)

'개발 > AI&Chatbot' 카테고리의 다른 글
| 예제를 활용한 복습(변수/조건문/반복문/리스트/함수) (0) | 2025.10.16 |
|---|---|
| Day04. 모듈 / NumPy / Pandas (0) | 2025.10.16 |
| ⛔️ [SyntaxError] 개념, 예시, 해결방법 (0) | 2025.10.15 |
| Day02. 파이썬 입문 - list (0) | 2025.10.14 |
| Day01. 파이썬 기초 - 변수, f-string, 조건문, 반복문 (0) | 2025.10.13 |