5 Reading Python code: Part 2

 

This chapter covers

  • Repeating code the required number of times using loops
  • Using indentation to tell Python which code goes together
  • Building dictionaries to store pairs of associated values
  • Setting up files to read and process data
  • Adding modules to extend Python into new domains
  • Asking Copilot to explain code

In chapter 4, we explored five Python features that you’re going to see all the time as you continue in your programming journey: functions, variables, conditionals (if statements), strings, and lists. You need to know those features to read code, and we explained why being able to read code is important whether or not we’re using Copilot.

We’re going to continue in this chapter with five more Python features, which will round out our top 10. As in chapter 4, we’ll do this through a combination of our own explanations, explanations from Copilot, and experimenting at the Python prompt.

5.1 Top 10 programming features you need to know: Part 2

Let’s continue where we left off in the last chapter with feature number 6.

5.1.1 #6. Loops

5.1.2 #7. Indentation

5.1.3 #8. Dictionaries

5.1.4 #9. Files

5.1.5 #10. Modules

Summary