More Play: First Concepts 🤾

We’ve already played with a REPL a bit, but let’s keep going.

Changing Case

Make a name variable containing your name and see if you can figure out how to make it all uppercase or all lowercase.

You’ll probably want to look through the Python documentation on strings to figure this out.

Hint

These are called “string methods”. For the moment you don’t need to know what they are exactly, but it’s good to know how you use them. To do so, add .nameofmethod() to whatever you’re trying to change.

Multiplication, Division, and Powers

  1. Type this code at the REPL and note what happens. Is the result what you expected?
>>> x = 7
>>> y = 12
>>> z = x * y
>>> z = 10
>>> z
  1. Play around with multiplication and division. Try big numbers, small numbers, and floats. Is anything surprising?
  2. What do you expect to happen if you raise a large number to the power of a large number? What did happen?
  3. Can you figure out what % does?

Multi-line Strings

How do you print a string that includes multiple lines of text?