Ask Question
11 December, 13:11

The PadRight function has two parameters: S (a string) and N (an int), and returns as its result the string S padded on the right with blanks until the length of S contains no fewer than N characters. The PadLeft function is identical to PadRight except that it adds blanks to the left side of the string. For example, the string "Frog" is four characters long, so PadLeft ("Frog",7) would return the

+1
Answers (1)
  1. 11 December, 16:46
    0
    The following code is written in python programming language:

    def PadRight (S, N) : #define user defined function

    if (len (S)
    S=S. ljust (N) #set the space to right

    return S # return the result

    def PadLeft (S, N) : #define user defined function

    if (len (S)
    S=S. rjust (N) # set the space to left

    return S # return the result

    '''calling the function'''

    print (PadLeft ("Frog",7))

    print (PadRight ("Frog",7))

    Output:

    Frog

    Frog

    Explanation:

    Here, we define a user defined function "PadRight () " and pass two arguments in its parameter "S", "N".

    Then, set the if condition and pass condition "len (S)
    After that, we again define a user defined function "PadLeft () " and pass two arguments in its parameter "S", "N".

    Then, set the if condition and pass condition "len (S)
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “The PadRight function has two parameters: S (a string) and N (an int), and returns as its result the string S padded on the right with ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers