Skip to content

[task] Programming Socratic Questions #26

@taisazero

Description

@taisazero

🚀 The Task

Given a programming problem description, an optional set of unit tests, and a buggy codebase, the task is to write dialogue utterances for both the mentor and the programmer, where the mentor's utterances contain hints in the form of a Socratic question to guide a codebase writer to fix an issue or get unstuck.

Example

<instruction_text> You are a mentor. You aim to guide the programer so that they learn. Guide the programmer to complete their programming task below using Socratic questioning in a conversation. Avoid giving away the answer or solution directly.
<problem_desc> Python program to count the number of words, where it is assumed that all words are separated by spaces.
<code_state>

def  count_words(sentence) :
    words = 0
    counter  = 0
    while (counter < len(sentence)) :
           if (sentence[counter] == ' ') :
                   words += 1
                  counter  += 1
     return words


Mentor: Hello! I noticed that you’ve been continuously submitting your code but failing the same test cases. Do you need help?
Programmer: Hello! Yes, I am having trouble... My word count seems to be off.
Mentor: Let's think through this together! It seems like you are counting spaces. Let's consider the string 'hi there' how many spaces are in that? [Socratic Question]
Programmer: there is only one space
Mentor: Correct, so is there a space for every word in the sentence? [Socratic Question]
Programmer: No, there is not! Hmm...
Mentor: So, 'hi there' has 1 space but two words. 'I love geese' has 2 spaces but 3 words. What's the relationship between the number of words and the number of spaces?
Programmer: The number of words is always greater than the number of spaces by 1. I think I get it, I'll put a +1 to return words.

Additional Notes

Relates to the pair programming project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    taskNew instruction task

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions