Computer programming has emerged as an important field in K‐12 science, technology, engineering, and maths (STEM) education in the AI era. However, contemporary programming education is hindered by fragmented course content, high complexity, and difficulties in maintaining engagement, impeding smooth progress. More effective collaborative learning strategies need to be explored. This study constructed jigsaw‐integrated task‐driven learning (jigsaw‐TDL) in a high school Python programming course under a STEM curriculum and verified its teaching effectiveness on students’ learning motivation, computational thinking, collaborative skills, and programming performance both quantitatively and qualitatively. Nighty‐nine high school students were randomly assigned to a jigsaw‐TDL group and a general collaborative task‐driven learning group (collaborative‐TDL). During the experiment, a Python programming course was introduced over 7 weeks. Questionnaires, programming tasks, and semistructured interviews were comprehensively applied to examine students’ learning outcomes. Finally, the jigsaw‐TDL group showed significantly better performance than the collaborative‐TDL group in learning motivation, computational thinking, and collaborative skills. However, it only led to better programming performance in the less complex tasks. The majority of students held a positive attitude toward the jigsaw‐TDL model, acknowledging its benefits in group collaboration, programming knowledge acquisition, and application. This research provides empirical evidence and potential guidance for task organization and collaborative learning support in programming courses and STEM education.