Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 2.7 Brave Sir Robin Learning Objectives: - Lists and Dictionaries (Chapters 10 and 11) - Loops (Chapters 7 and 8) Introduction In this scene

Python 2.7

Brave Sir Robin

Learning Objectives:

- Lists and Dictionaries (Chapters 10 and 11)

- Loops (Chapters 7 and 8)

Introduction

In this scene from the movie Monty Python and the Holy Grail, Sir Robin encounters a giant knight with three heads. They want to cut his head off, but Sir Robin is able to escape without them noticing. After which, brave Sir Robins minstrels start singing a new song:

MINSTREL (singing): Brave Sir Robin ran away

ROBIN: No!

MINSTREL (singing): Bravely ran away away

ROBIN: I didn't!

MINSTREL (singing): When danger reared its ugly head, He bravely turned his tail and fled

ROBIN: No!

MINSTREL (singing): Yes Brave Sir Robin turned about

ROBIN: I didn't!

MINSTREL (singing): And gallantly he chickened out, Bravely taking to his feet

ROBIN: I never did!

MINSTREL (singing): He beat a very brave retreat

ROBIN: Oh, lie!

MINSTREL (singing): Bravest of the brave Sir Robin

ROBIN: I never!

However, the director of the new version of Monty Python and the Holy Grail wants to be more modern, and put YOU in the role as the brave knight!

(Below are video links to the scenes related to the above scenes/episodes.)

The Tale of Sir Robin: https://www.youtube.com/watch?v=c4SJ0xR2_bQ

Objectives

For this assignment, you are to create a program using the Python programming language to:

1. Read in the script above between the MINSTREL and ROBIN into a list of lists;

2. Convert all occurrences of Robin (and ROBIN) to your name; and

3. Display a new, revised script.

You will also be creating a high-level design of your program.

Requirements

1. High-level (pseudo-code) design of your program, in the header (comments) of the file.

2. A variable that is a list of lists.

3. First function that takes no parameters, but returns a list of lists. The function should do the following, using a for loop:

a. Read from the keyboard a single line entered by the user, one at a time, where each line that is entered is added as a list of words to a list of lists. For example:

Hello World

It is me

would be stored in the list of lists as:

[[Hello,World], [It,is,me]]

NOTE: You might want to use a for loop inside of a for loop

b. Return the lists of lists.

4. Second function that takes a parameter of a list of lists, and returns a NEW list of lists. The function should do the following, using a for loop:

a. Update the global list of lists by exchanging every occurrence of the words ROBIN or Robin with YOUR name.

b. Return the NEW list of lists.

5. Third function that takes a parameter of a list of lists, and displays the words in the same format as the original script (see Introduction).

6. A program that uses all of the above functions to satisfy the objectives of the program.

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, AND, comments before EACH of the functions telling the reader what is their individual purpose.

Reminder and Hints

Remember, you can read user input from a keyboard using the following command:

text = raw_input()

Also, there is a function in Python that allows you to split a string into words. For example:

words = text.split()

You also need to think about how to terminate the function that is reading input from the user (i.e., how will it know when to stop taking input?)

Example Output:

Original Script:

MINSTREL (singing): Brave Sir Robin ran away

ROBIN: No!

New Script:

MINSTREL (singing): Brave Sir Bill ran away

BILL: No!

Try to put your own creative spin on your display!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions