Lab Exercise 7 Fun With Strings solution

$19.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

In this lab we explore operations and methods using string objects. Strings are non-scalar, immutable sequence objects consisting of an ordered collection of individual characters. Strings are primarily employed to represent text (words, sentences, names, paragraphs, etc.) but are often useful as data structures for other problems as well (genetic sequences, card games, state spaces, etc.). The primitive string operations and methods in Python provide a rich set of powerful constructs for manipulating these data in creative ways. The Python3 documentation is a great resource for learning about all the available (built-in) string methods:
https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str
Word Games A palindrome is a word or phrase in which the letters “read” the same way forward and backward. For example, “deed”, “kayak” and “Madam, I’m Adam” are all palindromes. An interesting computational problem is to decide if any given string is a palindrome: you provide a string containing a possible palindrome to the process, and it returns “yes” or “no”. Although this is fairly straightforward for humans to accomplish, doing so on a computer requires some skill in manipulating strings. Start Python in commandline mode and begin by entering a possible palindrome: p = “A man, a plan, a canal… Panama!”