Question

PYTHON PROGRAM In Robert McCloskey’s book Make Way for Ducklings, the names of the ducklings are...

PYTHON PROGRAM

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 tries to output these names in order.

prefixes = "JKLMNOPQ"
suffix = "ack"
for p in prefixes:
    print(p + suffix)  

Of course, that’s not quite right because Ouack and Quack are misspelled. Can you fix it?

0 0
Add a comment Improve this question Transcribed image text
Answer #1
prefixes = "JKLMNOPQ"
suffix = "ack"
for p in prefixes:
    if p == 'O' or p == 'Q':
        print(p + 'u' + suffix)
    else:
        print(p + suffix)

Jack Kack Lack Mack Nack Ouack Pack Quack

Add a comment
Know the answer?
Add Answer to:
PYTHON PROGRAM In Robert McCloskey’s book Make Way for Ducklings, the names of the ducklings are...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. program to use with number 1. 2. Comparing Python and Java Discussion Forum 14 days ago Use the Python...

    1. program to use with number 1. 2. Comparing Python and Java Discussion Forum 14 days ago Use the Python IDLE editor to create the source code for the "numberguess.py" pro- gram. This program is in the "Basic Python Pro- gramming" chapter in its "An Example Python Program: Guessing a Number" section. If you mistakenly create syntax errors, find and fix them. Run the program and test it with various values. Refer to the "numberguess.py Program document to see example...

  • You need not run Python programs on a computer in solving the following problems. Place your...

    You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...

  • Python Programming Chapter 5 Programming Exercise Dinner Selection Program (60 points total) Pseudocode (10 points) As...

    Python Programming Chapter 5 Programming Exercise Dinner Selection Program (60 points total) Pseudocode (10 points) As the family cook, you know that the toughest question of the day is "What's for dinner?" You For decide to write a program to help you do days of meal planning for the entree, side and dessert. You will need to use random numbers and functions to complete the project. What's Dinner? • • • Start with a pseudocode (10 points). Write the pseudocode...

  • please use python and provide run result, thank you! click on pic to make it bigger...

    please use python and provide run result, thank you! click on pic to make it bigger For this assignment you will have to investigate the use of the Python random library's random generator function, random.randrange(stop), randrange produces a random integer in the range of 0 to stop-1. You will need to import random at the top of your program. You can find this in the text or using the online resources given in the lectures A Slot Machine Simulation Understand...

  • PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP) Using a structured approach to writing the program: This section will...

    PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP) Using a structured approach to writing the program: This section will guide you in starting the program in a methodical way. The program will display a window with GUI widgets that are associated with particular functions: Employee Payroll O X -- - - - - - - - - - - Show Payroll Find Employee by Name Highest Lowest Find Employee by Amount Write Output to Fie Cancel - -------- ------------- Notice that some of...

  • Pseudocode & Python In this portion of the project you will analyze a problem and create...

    Pseudocode & Python In this portion of the project you will analyze a problem and create a Python program to solve it. In recent years, there has been more attention to Water Quality. Specifically the amount of lead that is found in our daily water supply. Lead and copper residue start to show up in our water supply due to aging pipes. This residue can be found in older homes that have not replaced their pipes and in the municipal...

  • python 11.8 Multiple committees The eventual goal of this assignment is to compute the total number...

    python 11.8 Multiple committees The eventual goal of this assignment is to compute the total number of ways of forming a collection of committees from an academic department of n professors. The first task is to write a function called committee to compute the number of ways of forming a single committee with members from a collection of n people. This is the same as compușing the number of ways of choosing r people out of n to sit at...

  • Python Program Eratosthenes of Cyrene lived approximately 275-195 BC. He was the first to accurately estimate...

    Python Program Eratosthenes of Cyrene lived approximately 275-195 BC. He was the first to accurately estimate the diameter of the earth. For several decades he served as the director and chief librarian of the famous library in Alexandria. He was highly regarded in the ancient world, but unfortunately only fragments of his writing have survived. The algorithm described for this assignment is known as the Sieve of Eratosthenes. The algorithm is designed to find all prime numbers within a given...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT