Chapter 7 ยท Part I: Basics

User Input and while Loops

Book: Ch. 7, 'User Input and while Loops', pp. 113โ€“128

Pages this chapter covers

Section titles and printed pages from the 3rd edition. Notes below use the full citation.

  • How the input() Function Worksp. 114
    • Writing Clear Promptsp. 114
    • Using int() to Accept Numerical Inputp. 115
    • The Modulo Operatorp. 116
  • Introducing while Loopsp. 117
    • The while Loop in Actionp. 117
    • Letting the User Choose When to Quitp. 118
    • Using a Flagp. 120
    • Using break to Exit a Loopp. 121
    • Using continue in a Loopp. 122
    • Avoiding Infinite Loopsp. 122
  • Using a while Loop with Lists and Dictionariesp. 124
    • Moving Items from One List to Anotherp. 124
    • Removing All Instances of Specific Values from a Listp. 125
    • Filling a Dictionary with User Inputp. 125
  • Summaryp. 127

Notes

Notes are not written yet

The section list above is only a map of the book, with printed page numbers, so you can read the chapter and come back. Original notes for this chapter are still to come.