Manners

In the second part of the lab, we will practice comparing strings. We will also use logical operators (and, or, and not) to combine multiple conditional statements.





Creating your new program

You are going to write a simple Python program called polite.py.

Once you are in your lab4 folder, open your file for editing by typing

       emacs polite.py

The first thing you should do in your new file is create and fill out the comment header block at the top of your file. Here is a template (it is text, so feel free to copy and paste it into your file):

# File:        polite.py
# Author:      YOUR NAME
# Date:        TODAY'S DATE
# Section:     YOUR SECTION NUMBER
# E-mail:      USERNAME@umbc.edu
# Description: YOUR DESCRIPTION GOES HERE AND HERE
#              YOUR DESCRIPTION CONTINUED SOME MORE
# Collaboration: During lab, collaboration between students is allowed,
#                although I understand I still must understand the material
#                and complete the assignment myself.





Input

First, ask the user to input a word of their choice. If the word is "please" or "thanks" or "pardon" exactly, you want to tell the user that they have manners.





Process

Using if statements, check if the word is "please" or "thanks" or "pardon" in lowercase.

(Python is case-sensitive, so "please" is not the same as "Please" or "PLEASE" when you are comparing strings.)

You should be able to do all of this with just four lines of code! Don't forget that the Boolean operators "and" and "or" exist!





Sample output

Here is a sample run of the program, to give you an idea of what your program could look like. The exact text of the prompts may differ, but the order in which the information is asked for, and the eventual result printed out should be the same as the sample.

User input is shown in blue.

bash-4.1$ python polite.py
Please enter a word: please
Your manners are impeccable

bash-4.1$ python polite.py
Please enter a word: PLEASE
How utterly rude!

bash-4.1$ python polite.py
Please enter a word: disgusting
How utterly rude!
bash-4.1$