Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 7.3.4: Find the Error 5 points Let's Go! In this exercise, you will try to identify which of two lines will cause an error.

Exercise 7.3.4: Find the Error

5 points

Let's Go!

In this exercise, you will try to identify which of two lines will cause an error. The two lines look like this:

my_string[0] = "H" my_string = "H" + my_string[1:]

Each line is an attempt to change the string from "hello!" to "Hello!". One of them does this in an acceptable way, and the other one causes an error.

Before you run the program, see if you can predict which of the two lines is incorrect. Test your guess by commenting out what you think is the incorrect line and running the program!

Exercise 7.4.7: Spelling Bee

5 points

Let's Go!

You are in a spelling bee! Dont worry - even if your spelling is a little rusty, you have Python to help you out.

Using a for loop, add some code to this program that prints each letter of the given word. Each letter should be on its own line.

And since you are so excited to be in this spelling bee, you should add an exclamation mark after each letter.

The output should look like this:

Your word is: eggplant. e! g! g! p! l! a! n! t!

Exercise 7.5.5: Contains a Vowel

5 points

Let's Go!

Write the function called contains_vowel that returns whether a string contains a vowel (a, e, i, o, or u).

contains_vowel("hymn") # => False
contains_vowel("hum") # => True
contains_vowel("bubble") # => True

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions