Problem:Python provides a built-in function called len that returns the length of a string, so the value of len('allen') is 5.Write a function named rightjustify that takes a string named s as a parameter and prints the string with enough leading spaces so that the last letter of the string is in column 70 of the display. rightjustify('allen')allenI tried writing some codes as follows: def rightjustify(s). Print s.
Python essential exercise is to help Python beginners to quickly learn basic skills by solving the questions.When you complete each question, you get more familiar with a control structure, loops, string, and list in Python. Exercises: Functions Exercise 1. Write a shutting down program: First, def a function, shutdown, that takes one argument s.Then, if the shutdown function receives an s equal to 'yes', it should return 'Shutting down' Alternatively, elif s is equal to 'no', then the function should return 'Shutdown aborted'. Finally, if shutdown gets anything other than those inputs, the function should.
rightjustify('allen') allenThe result is without enough leading spaces required by the exercise. And I couldn't use the built-in function len to help solve it either.Any idea on how to resolve this problem? Closed as off-topic by, Jan 24 '15 at 19:15This question appears to be off-topic.
The users who voted to close gave this specific reason:. 'Questions seeking debugging help (' why isn't this code working?'
) must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. – jonrsharpe, Marcin, fredtantini, Ajay S, Infinite RecursionIf this question can be reworded to fit the rules in the, please.