Python Versus C++: An Analysis of Student Struggle on SmallCoding Exercises in Introductory Programming Courses
Published 2018
Authors
Nabeel Alzahrani
University of California, Riverside
Frank Vahid
University of California, Riverside
Alex Edgcomb
University of California, Riverside
Roman Lysecky
University of Arizona
Kevin Nguyen
University of California, Riverside
Abstract
Many teachers of CS 1 (introductory programming) have
switched to Python rather than C, C++, or Java. One reason is the
belief that Python’s interpreted nature plus simpler syntax and
semantics ease a student’s learning, but data supporting that belief
is scarce. This paper addresses the question: Do Python learners
struggle less than C++ learners? We analyzed student submissions
on small coding exercises in CS 1 courses at 20 different
universities, 10 courses using Python, and 11 using C++. Each
course used either the Python or C++ version of an online
textbook from one publisher, each book having 100+ small coding
exercises, expected to take 2-5 minutes each. We considered 11
exercises whose Python and C++ versions were nearly identical
and that appeared in various chapters. We defined struggle rate for
exercises, where struggle means a student spent excessive time or
attempts on an exercise. Based on that rate, we found the learning
for Python was not eased; in fact, Python students had
significantly higher struggle rates than C++ students (26% vs.
13%). Higher rates were seen even when considering only classes
with no prerequisites, classes for majors only, or classes for non-
majors only. We encourage the community to do further analyses,
to help guide teachers when choosing a CS 1 language.