Skip to main content

Exercises 1.18 Exercises

1.

This exercise will let you practice displaying information. Write a program that prints following:
  • Your name.
  • Your favorite color.
  • Your favorite word, in double quotes. (See the Hint below the activecode area.)
  • Your favorite poem, at least three lines long (If your favorite poem is longer than ten lines, give only the first three to ten lines.)
  • The author of the poem. The name should be indented four spaces and preceded by a hyphen and a space. If you don’t know who wrote the poem, use “Anonymous” as the author.
Use complete sentences and blank lines for readability. To print a blank line, use:
print()
The parentheses are required, even though there is nothing between them. If you don’t believe me, leave them out and see what the output looks like!
Here is what the output of a possible solution looks like:
My name is Juana Fulano.
My favorite color is purple.
My favorite word is "giraffe".

My favorite poem:

Greet the dawn,
Rise with the sun.
Rejoice in the sunset
When day is done.
    - Anonymous
Hint.
You can use either single quotes or double quotes to enclose a string in Python. That lets you do something like this:
print('He said "Hello!" to me.')