asked 65.8k views
3 votes
7.1.5:Doghouse The string is “doghouse”, and you will need to print “h” and “e” using multiple index values. You should use the letters' positions to index. You should print h, e, and e. python

1 Answer

5 votes

Answer:

strs = "doghouse"

print(strs[4])

print(strs[7])

print(strs[7])

Step-by-step explanation:

Given


String =

Required

Print h, e and e.

Let the variable name be strs.

So, we have:


strs =

The index of h is 3.

So,

print(strs[4]) will print h

Similarly,

The index of e is 7.

So,

print(strs[7]) will print e

So, the code to print h, e and e is:

strs = "doghouse"

print(strs[4])

print(strs[7])

print(strs[7])

answered
User Matias Seguel
by
7.7k points

No related questions found