1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MA_775_DIABLO [31]
3 years ago
9

The PadRight function has two parameters: S (a string) and N (an int), and returns as its result the string S padded on the righ

t 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
Computers and Technology
1 answer:
oee [108]3 years ago
6 0

Answer:

The following code is written in python programming language:

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

 if(len(S)<N):    # set if condition

   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)<N):    # set if condition

   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)<N" then, if the condition is true then the code inside the if condition set the space to right then, return the output.

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)<N" then, if the condition is true then the code inside the if condition set the space to right then, return the output.

You might be interested in
You're creating a table for one of your slides, and need to make some modifications to your table structure. Which of the follow
sdas [7]
A. is the correct answer
6 0
3 years ago
Consider the following code segment.
m_a_m_a [10]

Answer:

10 20                                                                                                                          

30 40                                                                                                                          

50 60

Explanation:

Given

The above code segment

Required

What is printed, if anything

To do this, we analyze the code line by line.

Line 1: The first line creates a 4 by 3 array named mat

Line 2: for (int[] row : mat) {  -> This creates row[] array which represents each row of array mat

Line 3: for (int j = 0; j < row.length; j += 2){ -> This iterates through the even indexed elements of the row array i.e. 0 and 2

Line 4: System.out.print(row[i] + " "); -> This prints the even indexed elements of the row array.

The even indexed elements are: 10, 20, 30, 40, 50 and 60

Line 5: System.out.println(); --> This prints a new line

8 0
3 years ago
Celeste is writing a paper. However, two pages in, her computer shuts down unexpectedly. She never saved her paper, and all her
alekssr [168]
<span>Random access memory (RAM)</span>
8 0
3 years ago
Read 2 more answers
Which item would you most likely keep in a database
Soloha48 [4]
Search results, documents, photos, and videos.
5 0
3 years ago
Read 2 more answers
If E=mc2 then what does F equal?
Vladimir79 [104]

Answer:

First of all,there is not theory F=ma^2!!

Its F=ma and they are definitely not the same.Here F means force and E means Energy.

a means acceleration, but c means the velocity of light. Clearly there's difference between acceleration and velocity and force and energy.

F=ma can be applied on things we normally see but E=mc^2 is applied on things that can travel nearly in light speed!which means atoms,molecules, protons,electrons etc. energy can be determined by the Einstein theory but F=ma is for determining human energy, or energy of cars,vehicles or any regular moving things

Explanation:

4 0
2 years ago
Other questions:
  • Don is the superintendent of the county school system. What task might Don
    8·1 answer
  • Which one of these students is having a positive impact?
    8·2 answers
  • Olivia creates a personal budget. She enters her current savings account balance in cell D3. In cell A3, she calculates her inco
    8·1 answer
  • Write an app that reads an integer, then determines and displays whether the integer is odd or even. [Hint: Use the remainder op
    10·1 answer
  • Which behavior of the application should the user expect? A user profile has login hour restrictions set to Monday through Frida
    12·1 answer
  • Which type of financial institution typically has membership requirements?
    14·1 answer
  • Arrays of structures ________. Group of answer choices None of the above. are automatically passed by reference cannot be passed
    6·1 answer
  • What did Bakers wear (1) in the Portugal does (2) when was author was young ???
    10·1 answer
  • Consider the following statement: String myMiddleInitial = “h”;
    15·1 answer
  • Question 2 of 10
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!