Learning Objectives • Create a function with the required parameter and return value • Use for loop to create a string with no spaces, no commas, no ? and!. Use .lower () or "".upper() to unify all characters in string Use slicing with step to get reversed string
Learning Objectives • Create a function with the required parameter and return value • Use for loop to create a string with no spaces, no commas, no ? and!. Use .lower () or "".upper() to unify all characters in string Use slicing with step to get reversed string
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
In python, please!
The code should contain __name__ == "__main__"

Transcribed Image Text:**Learning Objectives**
- Create a function with the required parameter and return value.
- Use for loop to create a string with no spaces, no commas, no ? and !.
- Use `.lower()` or `.upper()` to unify all characters in string.
- Use slicing with step to get reversed string.
**Instructions**
Have you heard about palindromes? About sentence palindromes? Examples of sentence palindromes: "Mr. Owl ate my metal worm", "Do geese see God?", "Was it a car or a cat I saw?" Please, help us check that the given sentences are palindromes.
1. Create a function `is_palindrome_sentence(..)` that has one string parameter and returns True if the parameter is a sentence palindrome and False otherwise.
1.1. Go over all string parameters and create a new string with no " ", ",", ".", "!", "?", "'"
1.2. Unify all characters in a created string using `upper` or `lower`.
1.3. Use slicing with specific steps to create a backward string (You also can use for loop, but try slicing if you can).
1.4. Compare the forward and backward strings to get the result and return it.
2. Create a program that would read a number of following sentences and as many sentences.
3. Check each sentence on being a palindrome.
4. Print the number of palindromes.

Transcribed Image Text:**Example function parameters:**
```plaintext
is_palindrome_sentence("Mr. Owl ate my metal worm")
```
**Example function return value:**
```plaintext
True
```
**Example program input:**
```plaintext
3
Do geese see God?
Was it a car or a cat I saw?
Hey, nice code!
```
**Example program output:**
```plaintext
2
```
**Explanation:**
This example demonstrates a function, `is_palindrome_sentence`, which checks if a given sentence is a palindrome. A palindrome is a word, phrase, or sequence that reads the same backward as forward, ignoring spaces, punctuation, and capitalization. The function takes a string as input and returns `True` if the sentence is a palindrome.
In the program input example, there are three sentences provided:
1. "Do geese see God?"
2. "Was it a car or a cat I saw?"
3. "Hey, nice code!"
The function evaluates these sentences, discovering that the first two are palindromes. Therefore, the program output is `2`, indicating that there are two palindrome sentences among the input.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY