Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 6 - Functions - Section 6.10 - Default Arguments - Check Point - MyProgrammingLab - Page 190: 6.21

Answer

The program have a SyntaxError and it can be corrected by placing parameter n before the parameter message in the definition of function nPrintln as follows, no other change is required: def nPrintln(n, message = "Welcome to Python!"):

Work Step by Step

As per proper python syntax the parameters with default value are always placed after the variables with no default value. In the given code the definition of nPrintln function he parameter message has a default value but it is placed before the parameter n which have no default value, hence the given code contains SyntaxError. This can be easily resolved by placing parameter n before the parameter message in the definition of function nPrintln.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.