Question
Python 2.7 Learning Objectives This assignment will test your knowledge of how to do the following in the Python language (overview of topics covered in
Python 2.7
Learning Objectives
This assignment will test your knowledge of how to do the following in the Python language (overview of topics covered in your Thinking Python book):
- Conditionals and control flow (Chapter 5.1-5.7)
- Abstraction and functions (Chapters 3 and 6)
- Keyboard input (Chapter 5.11) not something you have done in your homework!
Introduction
King Arthur goes in search of knights for the round table at Camelot. In his search, he comes across Sir Bedevere who appears to wise in the ways of science. In this scene, Sir Bedevere is instructing the peasants on how one determines if someone is a witch. King Arthur is so impressed with his logic, he asks Sir Bedevere the Wise to join him, along with Sir Lancelot the Brave, Sir Galahad the Pure, and Sir Robin the Not-Quite-So-Brave-as-Sir-Lancelot, on his quest to seek the Holy Grail. In addition, the group encounters many perils along their journey. The final peril occurs when they arrive at the Bridge of Death. Here they must each answer three questions from the bridge-keeper to pass, or be thrown into the Gorge of Eternal Peril...
(Below are video links to the scenes related to the above episodes.)
Witch Trial: https://www.youtube.com/watch?v=X2xlQaimsGg
Bridge of Death: https://www.youtube.com/watch?v=cV0tCphFMr8 Objective
For this assignment, you are to create a program using the Python programming language to:
1. Determine whether or the not the user of your program is a witch; and, if not a witch,
2. Determine whether or not you will let the user cross the bridge or be thrown into the Gorge of Eternal Peril.
You will also be creating a high-level design of your program.
Requirements
1. Design your program1
a. Write a high-level step by step of how your main program will work.
b. Put the high-level steps in the comment section at the top of your file.
2. Prompt the user for their name.
3. Tell the user that you are going to ask them questions to see if they are witch.
4. Create a function called are_you_a witch(name) that takes their name as a parameter and returns True or False depending upon their answers to the following questions (replacing
a.
b.
c.
d.
e. If the answer was No to all of the above questions, return False.
5. Upon return from the call to the are_you_a witch(name) function, if the return value is True, output that they (again, using their name) will be burned for being a witch, and exit the program.
6. If they make it this far, tell the user that you are going to ask them three questions that they must answer if they want to see the other side of the Bridge of Death.
7. Create a function called cross_the_bridge(name) that takes their name as a parameter and returns True or False depending upon their answers to the following questions:
a. What is your name? If what is entered does NOT match the name parameter, return False.
b. What is your quest? If they do NOT enter To seek the Holy Grail, return False.
c. What is your favorite color? If they do NOT enter Red or Blue, return False.
d. If they make it this far, return True.
8. Upon returning from the call to the cross_the_bridge(name) function, if the return value is False, throw them into the Gorge of Eternal Peril, else tell them they are free to seek the Holy Grail.
In addition, you must include comments at the top of your program file (right before your high-level design) that includes your name, assignment number, and date.
You are free to change the order of the logic in each of the functions above, but make sure that your logic is correct in the end!
Example Output:
What is your name?
Bill
I am going to ask you three questions to see if you are a witch.
Bill, does your nose looks like a witchs nose?
No
Bill, are you wearing witchs clothing?
No
Bill, did you turn someone into a newt?
No
Bill, do you weigh as much as a duck?
No
Congratulations! You are not a witch!
Stop! Who approaches the Bridge of Death must answer me these questions three, 'ere the other side he see.
What is your name?
Bill
What is your quest?
To seek the Holy Grail
What is your favorite color?
Red
Right. Off you go.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started