Ask Question
4 October, 12:47

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

+2
Answers (1)
  1. 4 October, 13:40
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers