Talk Like a Pirate

pirate.py: 8 points


The goal of this part of the lab is to give you experience manipulating and altering strings. In order to do this, you will write a program that prompts the user for a string and prints out a pirate-speak version of the string. To create your pirate-speak version, you should change any occurrence of the letter “r” into “rrr” (i.e., the letter r repeated three times). Some example runs of the program are below. You should not use the built-in replace() as part of this implementation!

Please enter a String to be pirated: agar agar
Arrr, matey, your String be: agarrr agarrr
Please enter a String to be pirated: arrr
Arrr, matey, your String be: arrrrrrrrr
Please enter a String to be pirated: hello
Arrr, matey, your String be: hello
Please enter a String to be pirated: I'm disinclined to acquiesce to your request
Arrr, matey, your String be: I'm disinclined to acquiesce to yourrr rrrequest

For details on how to loop over and manipulate strings, please see the Warmup.

Reminder

As you make progress on your program, don’t forget to commit and push your changes regularly!