quiz in python reading a text file : 
I am trying to ask the user to pick a quiz, read the relevant questions from a txt file, ask for user answers, validate and check they are correct then add up to scores.  I am completely self taught so have picked this code up from various sites but as I have adapted it it no longer works - what have I done wrong?  I know its probably something really obvious so please be gentle with me!

    enter code hereimport time

    def welcome():
    print ("Welcome to Mrs Askew's GCSE ICT Quiz")
    print()

    def get_name():
    firstname = input("What is your first name?:")
    secondname = input("What is your second name?:")
    print ("Good luck", firstname,", lets begin")
    return firstname
    return secondname

    def displaymenu():
    print("-------------------------------------------------------")
    print("Menu")
    print()
    print("1. Input and Output Devices")
    print("2. Collaborative working")
    print("3. quiz3")
    print("4. quiz4")
    print("5. view scores")
    print("6. Exit")
    print()
    print("-------------------------------------------------------")

    def getchoice():
    while True:
        print("enter number 1 to 6")
        quizchoice = input()
        print("You have chosen number "+quizchoice)
        print()
        if quizchoice >='1' and quizchoice <='6':
            print("that is a valid entry")
            break
        else:
            print("invalid entry")
    return quizchoice

    def main():
    welcome()
    get_name()
    while True:
        displaymenu()
        quizchoice = getchoice()
        print ("please chooses from the options above: ")
        if quizchoice == ("1"):
            the_file = open("questions.txt", "r")
            startquiz()
        elif quizchoice == ("2"):
            collaborativeworking()
            startquiz()
        else:
            break

    def collborativeworking():
    the_file = open("Collaborative working.txt", "r")
    return the_file

    def next_line(the_file):
    line = the_file.readline()
    line = line.replace("/", "\n")
    return line

    def next_block(the_file):
    category = next_line(the_file)
    question = next_line(the_file)
    answers = []
    
    for i in range(4):
        answers.append(next_line(the_file))
        
    correct = next_line(the_file)
    if correct:
        correct=correct[0]
        
    explanation = next_line(the_file)
    time.sleep(2)

    return category, question, answers, correct, explanation    

    def startquiz():
    title = next_line(the_file)
    score = 0
    category, question, answers, correct, explanation = next_block(the_file)
    while category:

        # ask a question
        print(category)
        print(question)
        for i in range(4):
            print("\t", i + 1, "-", answers[i])
        # get answer and validate
        while True:
            answer =(input("What's your answer?: "))
            if answer >= '1' and answer <='4': 
                    break
            else:
                print ("the number needs to be between 1 and 4, try again ")

        # check answer
        answer=str(answer)
        if answer == correct:
            print("\nRight!", end=" ")
    return score


    main()