Misconception: Students think that both the IF and the ELSE cases of a conditional are executed every single time a conditional runs.
Run a pair programming contest in Python to motivate, challenge, and boost students’ self-confidence.
Misconception: Students who first learn object-oriented programming in Python don’t realize they need to explicitly define instance variables in Java because this is done implicitly in Python.
Misconception: Students get confused with object-oriented programming in Python because function declarations explicitly take self as an argument, but function calls don’t use self as argument.
Have students complete CodeLab’s practice exercises to improve their skills in Python, Java, C++, or other programming languages.
Use command-line running scripts or IDEs over the Python shell, which students may find incredibly confusing.
Misconception: students forget about language-specific or paradigm-specific material (e.g., new/delete or types) when they switch between languages that don’t use the same concepts.
Focus on these four key concepts when first teaching C to help students with previous programing experiences transition from higher-level languages such as Python.
Draw attention to types when teaching students Python to help lay the groundwork for understanding types in lower-level programming languages they’ll learn about later.
Spend extra time teaching Big O in intro classes that use Python because the underlying implementation of Python lists is a mystery to students that leads students to believe many operations are constant, O(1), that are not.
Reinforce that certain types in Python such as lists are mutable while others (e.g. strings, tuples) are not. Students have difficulty tracing code that uses mutable types because they often forget this.
Get students paying attention to types in Python; although type declarations aren’t explicitly required in Python, they still exist and are crucial to understanding how Python manages data.
Forward students links to programs in Python Tutor and ask them to answer questions about how the code works to go over what happens during a function call to provide students in-depth practice.
Misconception: Return is a mystery to students because they may not understand that functions have an entry point and an exit point. This results in mistakes such as assuming Python will return the right thing.
Help students build intuition about recursion in Python by comparing each recursive call to a function call, which may be more intuitive for students in introductory classes.
Use Python as an introductory language rather than Java or C to allow students to focus on problem-solving more than syntax.
Have students who are transitioning from Python to Java explore the “From Python to Java” website to show them the differences between the two languages.