One possible way to create a word puzzle is to take the characters of the word, and re-arrange them in some random fashion. This is known as a transposition cipher, and is typically used to create word jumbles that you have likely seen in a newspaper. In this post-lab, you will demonstrate your knowledge of strings by writing a function that can perform a transposition on text.
Details
Write a function called transpose_characters(text)
,
which has one parameter, a string of text. It should return a
string with the same letters as the input string but in a random
order.
Make sure your program handles all necessary cases gracefully. What additional test cases should you check?
Sample Test Cases
Function Parameters | Sample Output |
---|---|
"Scotty" | Scytot |
"Bouchard" | hordcuBa |
Submission
Submit your program as a .py file on the course Inquire page before class on Monday October 20th.