dc.description.abstract | Worked examples are a useful tool for teaching programming, as they help reduce cognitive load by illustrating step-by-step problem-solving processes. However, creating high-quality worked examples is a time-intensive task for educators, and a one-size-fits-all approach often fails to meet the diverse needs of students at different skill levels. The emergence of Large Language Models (LLMs) offers a promising solution for generating educational content, yet existing applications typically produce generic examples that do not account for individual learner differences. This thesis investigates how LLM-generated worked examples can be systematically personalised based on student skill level. We developed prompts that generated worked examples tailored for novice, intermediate, and experienced learners, adapting factors such as step granularity, explanation depth, and assumed prior knowledge. The resulting examples were evaluated through an expert review by computer science educators and two user studies with students: a pilot study to assess perception and engagement, and a controlled experiment to compare code com- prehension outcomes between students using personalised versus generic examples. Our findings show that LLMs can successfully generate worked examples that are correct, logically structured, and show some distinctiveness across skill levels. Educators rated the examples as high quality, and students found the personalised content to be useful and well-matched to their abilities. While our study did not find conclusive evidence of improved learning gains due to a limited sample size, the positive evaluation from both educators and students suggests that personalising LLM-generated content is a valuable direction for creating more effective and engaging learning experiences in computer science education. We conclude this research by suggesting enhancements and modifications to the prompts to improve their effectiveness. | |