Distribute only Python runtime

Hello, I am a teacher and I would like to create a quiz generator app using Python at replit.com. Unfortunately, I can’t figure out how to share only the runtime of the program with my students. If the kids have access to my code, then they can see the answers. I would love it if I could create a quiz generator that would allow students to take a quiz by running the program but couldn’t see the source code with the answers. Any thoughts would be appreciated.
Best regards,
Michael

1 Like

Hello @mrwnphs !

Did you already check Teams for Education?
https://replit.com/site/teams-for-education

1 Like

I searched all over your website and I also googled around a lot. I can’t find anything to help.

Sign up for Replit Teams for Education, it provides additional features and privacy settings suitable for educational purposes.

You can do exactly what you want using the tool. You just need to create a separate file to the answer.
Also:
“And you can see which of your students are coding in real-time. All it takes is one click to join their session and see what they’re working on.”

I don’t think you are understanding what I’m asking for. I want to write a quiz program that can display multiple choice questions about math. I want students to be able to take the quiz, but I don’t want them to be able to see the source code for the program or the answers. I don’t want to use any replit quiz capability. I just want to create a program that can be used to quiz students.

Try using hashes.
Just hash each answer, then when the student enters the answer, hash the response and compare the two. If the hashes are the same, the answer is correct.

3 Likes

Oh I get it now.
The answer that @joecooldoo provided can suit you. You can use the haslib for that.

For example:

import hashlib

def hash_answer(answer):
    # You can use the sha256 hash of the answer
    return hashlib.sha256(answer.encode()).hexdigest()

#Than you store the hashed answers
answers = [hash_answer('5'), hash_answer('10'), hash_answer('15')]

#And later when a student provides an answer
student_answer = input('What is your answer? ')
hashed_student_answer = hash_answer(student_answer)

#After that you can check if the answer is correct like so:
if hashed_student_answer == answers[question_number]:
    print('Correct!')
else:
    print('Incorrect.')
2 Likes

However you cant just copy and paste that code into your program because the answers are still there. I would reccomend calculating the hashes beforehand (by printing the contents of answers after running the code) and putting those values into the repl’s code.

3 Likes

You can still see the answers lol

1 Like

yea, you should hash them first and implement them straight into the program

4 Likes

Great answer, thank you!

There is a way if you use Tkinter that comes with python automatically where you can hide the command prompt window during run time so your students will only see the gui app… I just don’t know the syntax that well but if you ask any chat AI ROBOT it can write out the tkinter script for you.

2 Likes