Chat-GPT4로 YBM COS PRO 모의고사 만들기-0

송전영·2024년 3월 10일

퇴사하고 다시 학원으로 들어간지언 2개월째.
아이들에게 Python을 가르치며, 자격증을 취득시켜야 하는 임무가 있습니다...

Chat GPT-4를 활용하여 프롬프트 엔지니어링을 통해서 Python 모의고사 문제를 만들어보았습니다.

COS PRO 3급 문제의 모의고사를 Chat GPT를 통해서 문제를 만드는 과정을 리얼하게 보여드립니다.

자격증

YBM COS PRO는토익을 만든 그 YBM에서 만든 프로그래밍 능력 평가 시험입니다.

COS Pro 설명

(YBM COS PRO사이트-https://www.ybmit.com/cos_pro/cos_pro_info.jsp)

샘플 문제

샘플문제 해당위치에 있습니다. 다운받아서 사용하면됩니다.


YBM COS PRO 샘플문제 -https://www.ybmit.com/cos_pro/cos_pro_r_test.jsp

파일 확인 (지문,문제)

문제와 지문으로 2개의 파일을 다운받았습니다.

지문

Description
pdf파일하나와 txt 파일이 있습니다.

pdf 파일

txt 파일

지문 파일에 대한 이해

두 파일의 경우에는 하나는 마크다운으로 쓰여진 pdf와 그 마크다운이 적혀있는 txt가 있습니다.

요런식 이라는 것을 알 수 있겠습니다.

문제번호

지문내용

입력설명
입력설명 내용

출력설명
출력설명 내용

입출력 예제1
입력예제
출력예제

입출력 예제2
입력예제
출력예제

문제

문제 파일은 아래와 같이 .cpp 확장자로 C++ 언어로 짜여진 코드입니다.

Vscode Editior 이용하여 열어보면 이렇게 확인해볼수 있습니다.

GPT-4로 문제만들기

C++문제를 Python 문제로 바꾸기

위의 파일과 비슷하게 10개의 문제를 .cpp에서 python으로 바꿔보겠습니다.

GPT에게 지시내리기

I gonna make python simple coding test exam, so i will show some exam example

지금부터 파이썬 코딩테스트 문제를 만들것이고, 문제 샘플을 보여주겠다고 영어로 작성하였습니다.

지금부터 파이썬 코딩테스트 문제를 만들것이고, 문제 샘플을 보여주겠다고 영어로 작성하였습니다.

업로드를 통해서 description을 보여줍니다.

there is 10 problem written by korean language

한국어로 쓰여진 문제가 10개가 있어

GPT가 주어진 문제에 대해서 잘 이해했다고 합니다.

these are .Cpp files of Problem. Can you make this problem to Python language?

.Cpp 파일들인데, 이 문제들을 파이썬 언어로 만들어 줄수 있을까?

C++문제를 Python 문제로 바꾸기 성공

바꿔달라는 프롬프트 이후 하단과 같은 결과물을 얻을 수 있었습니다.

결과

Certainly! I'll convert the provided C++ code snippets into Python for each problem. Let's start with the snippets you've shared:

  1. Problem 1 (Addition of Two Numbers):

    int a, b;
    cin >> a >> b;
    cout << a + b << endl;

    Python version:

    a = int(input())
    b = int(input())
    print(a + b)
  2. Problem 2 (Longer String):
    C++ version appears to be incomplete, but based on the problem description, here's the Python code:

    string1 = input()
    string2 = input()
    print(string1 if len(string1) > len(string2) else string2)
  3. Problem 3 (Inverted Right-Angle Triangle):
    C++ version is incomplete, but here's the Python code based on the description:

    n = int(input())
    for i in range(n, 0, -1):
        print('*' * i)
  4. Problem 4 (Quoting a String):

    string a;
    cin >> a;
    cout << '"' << a << '"' << endl;

    Python version:

    a = input()
    print(f'"{a}"')
  5. Problem 5 (Absolute Value):
    C++ version is incomplete, but based on the problem description, here's the Python code:

    num = int(input())
    print(abs(num))
  6. Problem 6 (Sum or Difference):
    C++ version is incomplete, but here's the Python code based on the description:

    a = int(input())
    b = int(input())
    print(a + b if a == b else abs(a - b))
  7. Problem 7 (Print Numbers 1 to N):

    int n;
    cin >> n;
    int i = 1;
    while(i <= n) {
        cout << i << endl;
        i++;
    }

    Python version:

    n = int(input())
    for i in range(1, n + 1):
        print(i)
  8. Problem 8 (Adjacent Differences in Array):

    int n, arr[50];
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    for(int i = 0; i < n - 1; i++) {
        cout << arr[i] - arr[i + 1] << endl;
    }

    Python version:

    n = int(input())
    arr = [int(x) for x in input().split()]
    for i in range(n - 1):
        print(arr[i] - arr[i + 1])
  9. Problem 9 (Reverse a Number):

    string n;
    cin >> n;
    for(int i = n.length() - 1; i >= 0; i--) {
        cout << n[i];
    }

    Python version:

    n = input()
    print(n[::-1])
  10. Problem 10 (Count of '1' in a String):
    C++ version is incomplete, but based on the problem description, here's the Python code:

    s = input()
    print(s.count('1'))

These Python versions should work similarly to the C++ versions, adhering to the requirements of each problem.

profile
전 클라우드엔지니어, 교원대 현 교원대 컴퓨터교육과 석사과정생

0개의 댓글