Warning! It seems that you are using Dodona within another webpage, so not everything may work properly. Let your teacher know so that he can solve the problem by adjusting a setting in the learning environment. In the meantime, you can click this link to open Dodona in a new window.
Warning! The page was not fully loaded, probably because of a network issue. It could be that not all functionalities work as expected. Please try reloading the page.
# School club program
# -------------------------
# Subprograms
# -------------------------
def add_student():
student = input("Enter your name to sign up for the club: ")
student = student + "\n"
file = open("programming.txt", "a")
file.write (student)
file.close()
print("You have been signed up", student)
def show_students():
print("Students that signed up for the programming club:")
file = open("programming.txt", "r")
for student in file:
student = student.strip()
print(student)
file.close()
def menu():
print("1. Sign up")
print("2. Show students")
choice = ""
while choice not in ["1", "2"]:
choice = input("Enter choice: ")
match choice:
case "1":
add_student()
case "2":
show_students()
# -------------------------
# Main program
# -------------------------
menu()
Python sandbox
This window allows you to run Python code without installing a thing. The code you write here is not automatically submitted to Dodona.