Home > Articles > Open Source > Python

  • Print
  • + Share This
This chapter is from the book

Workshop

The Workshop contains quiz questions and exercises to help you solidify your understanding of the material covered. Try to answer all questions before looking at the answers that follow.

Quiz

  1. What characters can be stored in strings?
  2. What math operators work with strings?
  3. What is the backslash character (\) called? What is it used for?

Answers

  1. Alphabetic characters, numbers, and symbols can all be stored in strings, as well as whitespace characters such as spaces and tabs.
  2. Addition and multiplication operators work with strings.
  3. The backslash is called an “escape” and indicates that you want to include some special formatting, such as a tab, new line, a single or double quote, or a backslash.

Exercise

In your program, you’re given a string that contains the body of an email. If the email contains the word “emergency,” print out “Do you want to make this email urgent?” If it contains the word “joke,” print out “Do you want to set this email as non-urgent?”

  • + Share This
  • 🔖 Save To Your Account