HOLIDAY SALE! Save 50% on Membership with code HOLIDAY50. Save 15% on Mentorship with code HOLIDAY15.

11) User Input and String Formatting Lesson

Section Recap

3 min to complete · By Martin Breuss

If you haven't yet, make sure to build out the command-line game following the instructions from a few lessons earlier. Make it exciting!

Monster chasing figure - Photo by Robert Coelho https://unsplash.com/@robert_coelho

Once you've got a working version done, show it to your friends and family and let them give it a spin. Feel free to share a link to your game on Discord!

Section Summary: Input and String Formatting

In this section on user input and string formatting, you learned more important programming concepts:

  • Collecting user input with input()
  • Looping with while loops
  • Changing the flow of execution in loops with the loop keywords break and continue
  • Formatting your strings

At this point, you've covered all but one concept that you encountered at the beginning of this course in the guess-the-number game:

Programming concepts signified in colored boxes

What's Next

The final puzzle piece that is still missing is how to import and use code that other people wrote. In the guess-the-number game, you used a module from the built-in standard library called random, which allows you to introduce some randomness into your code. This can be fun and helpful, especially when you're working on games.

In the upcoming section, you'll learn how you can access and use code such as the random module and dramatically increase what you can build with your code by climbing on the shoulders of giants who came before you and built code logic that is powerful and user-friendly to work with.

You'll use one of such modules, called pathlib, to automate some tasks right on your computer's file system using pure Python.