Waived!

Between a Rock and a Hard Place Given a string in a variable named text write code that finds the

(4 customer reviews)

$5.00

Download button will appear immediately after successful payment.

Full support will be provided with necessary files installation.

Get impeccable customized solution within 24 hours, hassle-free.

View Details
SKU: 4678 Category: Tags: , , , , , , , , , , , , , , , , , , , , ,
Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.
Instant
Download

Description

Between a Rock and a Hard Place

Given a string in a variable named text, write code that finds the substring that lies between the substring ‘rock’ and the substring ‘hard place’. For example, if text contains ‘here is a rock and here is a hard place’, then the result would be ‘ and here is a’. Assign the result to a variable named between. Assume that text already has a value that contains the substrings ‘rock’ and ‘hard place’ in that order.

Print the Longer String

Write code that prints the longer of two strings that are stored in the variables str1 and str2. If both strings are equal in length, print the value of str1. Assume that both variables have already been given values.

Print Product Id

Write code that examines a string stored in a variable called product_id and prints an appropriate version of the id. If the id is composed of only numeric digits, print it as is. If it is composed of a combination of alphabetic letters and digits, print the id with all alphabetic letters in uppercase. Otherwise (if there are any other types of characters in the id), print it with all alphabetic letters in lowercase. Assume that the product id has already been initialized.

Double Word

Write code that constructs a string made up of each character in a string variable named word repeated twice. For example, if word contains ‘Python’, the resulting string would be ‘PPyytthhoonn’. Store the constructed string in a variable called double_word. Assume that word has already been initialized.

How Do You Spell That?

Write code that produces a string made up of each character in a string variable named word separated by a dash. For example, if word contained the string ‘Python’, the resulting string would be ‘P-y-t-h-o-n’. Do NOT include a dash after the last character. Store the resulting string in a variable named spell_string. Assume that the variable word has already been initialized.

Generate Acronyms

Given a phrase stored in the variable phrase, write code to construct an acronym made up of the first letter of each word in the phrase. For example, the phrase ‘Portable Network Graphics’ would produce the acronym ‘PNG’. Store the result in a variable named acronym, ensuring that it is composed of all uppercase letters. Assume that there is no whitespace on either end of the phrase and that one space character separates each word.

Back to Front

Write code that constructs a string made by flipping the front and back halves of a string stored in a variable named flip_me. For example, if flip_me is ‘bookmark’, the resulting string is ‘markbook’. Store the result in a variable named flipped. Assume that the variable flip_me has already been given a value and that it contains an even number of characters.

Count It

Write code that determines how many times the string ‘it’ appears in the character string stored in a variable named sentence. Store the result in the variable it_count. Assume that sentence has been initialized.

Ideas and Thoughts

Write code that prints a string made up of the string stored in the variable sentence with all instances of the word ‘idea’ replaced with the word ‘thought’. Assume the sentence variable has already been initialized.


4 reviews for Between a Rock and a Hard Place Given a string in a variable named text write code that finds the

  1. Felicia Schoenthal

    Work was finished long before due and tutor was considerate and engaging. Perfect!

  2. Mike Snyder

    I am pleased for the assistance to get a answer to my questions. The service is prompt and provides good value to me.

  3. Brian Duke

    Solution I got is great! Before deadline and is great with changes

  4. Caroline Riberdy

    Follows the required notes. Right on time. Amazing solution.

Only logged in customers who have purchased this product may leave a review.


You may also like…

Patron Details

Additional information

Your Solution

Product
Quantity
Total
Cart Subtotal $0.00
Order Total $0.00

  • Pay with your credit card.