answer = 안녕이라면 출력값 = <입력한 값은 안녕입니다.> 이런 식으로 나오는가 이론 1-5 battery.txt파일에 김세종 : 77% 이세종 : 97% 강세종 : 47% 최세종 : 17% 라는 값을 넣어 파일을 새로 만들고 싶고 그 후에 박세종 : 87% 유세종 : 7% 라는 값을 battery.txt파일에 집어 넣고 싶을 때 다음 코드 중 틀린 점을"> answer = 안녕이라면 출력값 = <입력한 값은 안녕입니다.> 이런 식으로 나오는가 이론 1-5 battery.txt파일에 김세종 : 77% 이세종 : 97% 강세종 : 47% 최세종 : 17% 라는 값을 넣어 파일을 새로 만들고 싶고 그 후에 박세종 : 87% 유세종 : 7% 라는 값을 battery.txt파일에 집어 넣고 싶을 때 다음 코드 중 틀린 점을"> answer = 안녕이라면 출력값 = <입력한 값은 안녕입니다.> 이런 식으로 나오는가 이론 1-5 battery.txt파일에 김세종 : 77% 이세종 : 97% 강세종 : 47% 최세종 : 17% 라는 값을 넣어 파일을 새로 만들고 싶고 그 후에 박세종 : 87% 유세종 : 7% 라는 값을 battery.txt파일에 집어 넣고 싶을 때 다음 코드 중 틀린 점을">

이론 1-1 (b)

다음 중 표준 입력을 통해 사용자로부터 여러 줄의 텍스트를 입력받는 방법으로 올바른 것은?

a) **`input()`** 함수를 사용하여 입력받는다.
b) **`sys.stdin.readline()`** 함수를 사용하여 입력받는다.
c) **`raw_input()`** 함수를 사용하여 입력받는다.
d) **`getchar()`** 함수를 사용하여 입력받는다.

이론 1-2 (d)

다음 중 pickle 모듈의 주요 용도가 아닌 것은? 

a) 데이터를 직렬화하여 파일에 저장하고 읽기 위해 사용됨
b) 파이썬 객체를 다른 데이터 형식으로 변환하는 데 사용됨
c) 객체를 파일에 저장하고 다시 불러올 때 사용됨
d) 프로그램 실행 중에 발생하는 예외를 처리하기 위해 사용됨

이론 1-3 (알겠습니다.)
다음 코드를 실행하여 "data.txt" 파일에 사용자가 입력한 내용을 저장하는 파이썬 코드를 작성하시오.

with open("data.txt", "w") as f:
    data = input("파일에 저장할 내용을 입력하세요: ")
    f.write(data)

이론 1-4 (O)
answer = input("아무거나 입력하세요 : ")
print("입력한 값은" + answer + "입니다.")

다음과 같은 코드가 존재할 때 answer에다가 숫자를 입력하든 단어를 입력하든 오류가 나오지 않고 입력한 대로 정확히 나오는가?       (o,x로 답하시오.)

예) answer = 17이라면 출력값 = <입력한 값은 17입니다.>

     answer = 안녕이라면 출력값 = <입력한 값은 안녕입니다.>

     이런 식으로 나오는가

이론 1-5
battery.txt파일에 

김세종 : 77%
이세종 : 97%
강세종 : 47%
최세종 : 17%

라는 값을 넣어 파일을 새로 만들고 싶고

그 후에

박세종 : 87%

유세종 : 7%

라는 값을 battery.txt파일에 집어 넣고 싶을 때 다음 코드 중 틀린 점을 찾아 바르게 고치시오.

battery_file = open("battery.txt", "r", encoding="utf8")
print("김세종 : 77%", file=battery_file)
print("이세종 : 97%", file=battery_file)
print("강세종 : 47%", file=battery_file)
print("최세종 : 17%", file=battery_file)

battery_file = open("battery.txt", "w", encoding="utf8")
print("박세종 : 87%", file=battery_file)
print("유세종 : 7%", file=battery_file)

=>
battery_file = open("battery.txt", "w", encoding="utf8")
print("김세종 : 77%", file=battery_file)
print("이세종 : 97%", file=battery_file)
print("강세종 : 47%", file=battery_file)
print("최세종 : 17%", file=battery_file)
battery_file.close()
battery_file = open("battery.txt", "a", encoding="utf8")
print("박세종 : 87%", file=battery_file)
print("유세종 : 7%", file=battery_file)
battery_file.close()

이론 2-1 (O)
with open("favorite_sports.txt", "w", encoding="utf8") as favorite_sports_file:
    favorite_sports_file.write("Soccer")   

favorite_sports = open("favorite_sports.txt", "w", encoding="utf8")
print("Soccer", file=favorite_sports)
favorite_sports.close()

다음 두 코드는 같은 파일을 생성하는가? (o,x로 답하시오)

이론 2-2 (X)

def Hello(): print("Hello World") 를 실행하면 print("Hello World")가 출력된다.

이론 2-3 (X)

def hello():
    print("안녕하세요")
a = hello 를 컴파일하면 "안녕하세요"가 출력된다.

이론 2-4
아래의 코드는 나라별 인구 데이터를 출력하고 기록하는 코드입니다. 
country_population.txt에 이 데이터를 기록하기 위해 빈칸을 채워주세요

population_data = {"USA": 331, "India": 1380, "Brazil": 213}

# 콘솔에 인구 데이터 출력
for country, population in population_data.items():
    print(f"{country}: {population} million")

# 파일에 인구 정보 기록
[***********빈칸을 채워주세요***********]
    file.write("Country Population Details:\\n")
    for country, population in population_data.items():
        file.write(f"{country}: {population} million\\n")

[출력 예시]
USA: 331 million
India: 1380 million
Brazil: 213 million

=>
with open("country_population.txt", "w", encoding="utf8") as file:
    file.write("Country Population Details:\\n")
    for country, population in population_data.items():
        file.write(f"{country}: {population} million\\n")