File size: 1,523 Bytes
5e95e64 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# μ μλμ μ§λ¬Έ μ
λ ₯ λ°κΈ°
def teacher_question():
question = input("Enter your question: ")
return question
# νμλ€μ μμ± λ
Ήμ λ° μ μ₯
def record_student_voice(student_name, question, voice):
# μμ± νμΌ μ μ₯
file_path = f"recordings/{student_name}_{question}.wav"
os.makedirs("recordings", exist_ok=True)
with open(file_path, "wb") as f:
f.write(voice)
# μμ± νμΌ κ²½λ‘ μ μ₯
if question in recordings:
recordings[question].append(file_path)
else:
recordings[question] = [file_path]
return "Voice recorded successfully!"
# μ μ₯λ μμ± μ¬μ
def play_recorded_voice(question):
if question in recordings:
print("Available recordings:")
for index, file_path in enumerate(recordings[question], start=1):
print(f"{index}. {file_path}")
else:
print("No recordings available for this question.")
# μμ±μ λν μ½λ©νΈ μμ±
def write_comment(question, comment):
# μ½λ©νΈ μ μ₯ λ±μ μΆκ°μ μΈ μμ
μν κ°λ₯
return f"Comment '{comment}' added successfully for question '{question}'."
# μ μλμ μ§λ¬Έ μ
λ ₯
question = teacher_question()
# νμλ€μ μμ± λ
Ήμ λ° μ μ₯
student_name = input("Enter your name: ")
record_student_voice(student_name, question, b"Dummy voice data")
# μ μ₯λ μμ± μ¬μ
play_recorded_voice(question)
# μ½λ©νΈ μμ±
comment = input("Write your comment: ")
write_comment(question, comment)
|