question archive 1)Consider the loop below from Section 8

1)Consider the loop below from Section 8

Subject:Computer SciencePrice: Bought3

1)Consider the loop below from Section 8.3 of your textbook.

In Robert McCloskey's book Make Way for Ducklings, the names of the ducklings are Jack, Kack, Lack, Mack, Nack, Ouack, Pack, and Quack. This loop outputs these names in order.

 

prefixes = 'JKLMNOPQ'

suffix = 'ack' for letter in prefixes:

print(letter + suffix)

 

The output is:

Jack

Kack

Lack

Mack

Nack

Oack

Pack

Qack 

 

 

 

Put this code into a Python script and run it. Notice that it prints the names "Oack" and "Qack".

Modify the program so that it prints "Ouack" and "Quack" but leaves the other names the same.

Include the modified Python code and the output in your submission.

2. Give at least three examples that show different features of string slices. Describe the feature illustrated by each example. Invent your own examples. Do not copy them for the textbook or any other source.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions