This script contains four parts. 1) String Type Tests a. Ask the user for a string (test with "ABC123"). b. Use method isupper to test the string, print the result. c. Use method isdigit to test the string, print the result. d. Use method isalpha to test the string, print the result. 2) Escape Characters within a string Use newline escape characters within a line of haiku a. Assign the text "Type, type, type away. Compile. Run. Hip hip hooray! No error today!" to a single variable (be sure to add newline escape characters). This should be done in a single line of code. b. Print, so that the output appears as follows: Type, type, type away. Compile. Run. Hip hip hooray! No error today! Haiku by Samantha W. 3) Slicing a string a. Assign the text "And now for something completely different" to a variable called quote. b. Slice quote to obtain the text "And no" from the beginning of the quote, print the results. c. Slice quote to obtain the text "rent" from the end of the quote, print the results. d. Slice quote to obtain the text "ne" from the middle of the quote, print the results. e. Slice quote to obtain the text "Adnuf..." by extracting every other letter, print the results. f. Slice quote to obtain the text "tnere..." by reversing the quote, print the results. 4) Using string operators + and * a. Assign the text to a variable called pattern1. b. Create a variable called pattern2, assign to it patternl combined with patternl reversed. pattern2 should now contain the string" c. Print pattern2 repeated five times. The output should appear as follows:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please in python , thank you

This script contains four parts.

1) **String Type Tests**

   a. Ask the user for a string (test with "ABC123").
   
   b. Use method isupper to test the string, print the result.
   
   c. Use method isdigit to test the string, print the result.
   
   d. Use method isalpha to test the string, print the result.

2) **Escape Characters within a String**

   Use newline escape characters within a line of haiku.

   a. Assign the text "Type, type, type away. Compile. Run. Hip hip hooray! No error today!" to a single variable (be sure to add newline escape characters). This should be done in a single line of code.
   
   b. Print, so that the output appears as follows:
   
   ```
   Type, type, type away.
   Compile. Run. Hip hip hooray!
   No error today!
   ```

   [Haiku by Samantha W.]

3) **Slicing a String**

   a. Assign the text "And now for something completely different" to a variable called quote.
   
   b. Slice quote to obtain the text "And" from the beginning of the quote, print the results.
   
   c. Slice quote to obtain the text "rent" from the end of the quote, print the results.
   
   d. Slice quote to obtain the text "now" from the middle of the quote, print the results.
   
   e. Slice quote to obtain the text "And...by" by extracting every other letter, print the results.
   
   f. Slice quote to obtain the text "nereffid" by reversing the quote, print the results.

4) **Using String Operators * and +**

   a. Assign the text ".~*" to a variable called pattern1.
   
   b. Create a variable called pattern2, assign to it pattern1 combined with pattern1 reversed. pattern2 should now contain the string ".~* *~.".
   
   c. Print pattern2 repeated five times. The output should appear as follows:

   ```
   .~**~..~**~..~**~..~**~..~**~.
   ```
Transcribed Image Text:This script contains four parts. 1) **String Type Tests** a. Ask the user for a string (test with "ABC123"). b. Use method isupper to test the string, print the result. c. Use method isdigit to test the string, print the result. d. Use method isalpha to test the string, print the result. 2) **Escape Characters within a String** Use newline escape characters within a line of haiku. a. Assign the text "Type, type, type away. Compile. Run. Hip hip hooray! No error today!" to a single variable (be sure to add newline escape characters). This should be done in a single line of code. b. Print, so that the output appears as follows: ``` Type, type, type away. Compile. Run. Hip hip hooray! No error today! ``` [Haiku by Samantha W.] 3) **Slicing a String** a. Assign the text "And now for something completely different" to a variable called quote. b. Slice quote to obtain the text "And" from the beginning of the quote, print the results. c. Slice quote to obtain the text "rent" from the end of the quote, print the results. d. Slice quote to obtain the text "now" from the middle of the quote, print the results. e. Slice quote to obtain the text "And...by" by extracting every other letter, print the results. f. Slice quote to obtain the text "nereffid" by reversing the quote, print the results. 4) **Using String Operators * and +** a. Assign the text ".~*" to a variable called pattern1. b. Create a variable called pattern2, assign to it pattern1 combined with pattern1 reversed. pattern2 should now contain the string ".~* *~.". c. Print pattern2 repeated five times. The output should appear as follows: ``` .~**~..~**~..~**~..~**~..~**~. ```
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Methods of StringBuilder class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education