answer.
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
Schach [20]
2 years ago
15

Write a function called ReverseLetters that takes an input phrase consisting of a single word and reverses the sequence of lette

rs between the first letter and last letter. The input phrase could be a character vector of any length.
Computers and Technology
1 answer:
ad-work [718]2 years ago
4 0

Answer:

# The function reverseLetter is defined

def reverseLetter(received_word):

   # The first letter of the word is assigned to a variable using index 0

   firstLetter = received_word[0]

   # The last letter of the word is assigned to a variable using index of

   # string length - 1

   lastLetter = received_word[len(received_word) - 1]

   # reverse letters in between first and last letter is defined as

  # empty string

   reverseBetween = ""

   # A counter is defined to control the loop during the reversal

   # counter value is 2 from the length of the received string

   # The 2 is for the first and last letter remove

   counter = len(received_word) - 2

   # The while loop start

   while counter >= 1:

       # The reverseBetween string is concatenated with corresponding

      # index of received word

       # The index is from high to low since the process is string reversal

       reverseBetween += received_word[counter]

       # The value of counter is decremented

       counter -= 1

   # The reversed string is displayed with no separator

   print(firstLetter, reverseBetween, lastLetter, sep="")    

Explanation:

The code is well commented.

reverseLetter("come") will output cmoe

reverseLetter("welcome") will output wmoclee

reverseLetter("brainly") will output blniary

You might be interested in
Which references are updated when you copy the formula =$E6-MAX(H$1:J4)
kykrilka [37]

Once you uncover the mystery of Absolute References, copying and pasting formulas becomes child’s play.

You might have seen cell references in formulas surrounded by ‘$’ signs. For example $D$3:$D$10.  What’s that all about?

Excel Absolute References

Well, the ‘$’ before the column or row reference instructs excel to keep the reference absolute.  Huh, I hear you say.  Ok, I’ll explain in English.

Looking at the table below we have a Commission Rate of 3% in cell G3.  In column E we want to calculate the commission as Total $k x Commission Rate 3%.

Excel Absolute References

I could simply enter the formula as =D3*3% and copy it down column E, but there are two problems with this that make it not ideal:

1)      I can’t easily see what the Commission Rate is without looking in the formula bar.  I could put it as part of the column heading e.g. ‘Commission $ @ 3%’, but that makes my heading bigger than it needs to be, and if I change the rate at a later date I have to go back and change the heading too, which is easily overlooked.

2)      If I change the rate I need to change the formula and copy it down the column again. Ok, so it might only take a few seconds to do this, but if you’re playing with scenarios and you want to change the rate a few times to see what the results are it’s much quicker and easier to just type a new figure in cell G3 and let Excel do the work to change the formula.

So assuming I’ve convinced you that referencing one cell for the commission rate is the best method let’s look at how absolute references work.

Absolute Reference example

First let’s look at what happens if you don’t use an absolute reference.  If you entered in cell E3 the formula =D3*G3 you would get the correct answer.  But if you were to copy that formula down the rest of column E Excel would dynamically update the formula to increase by one row as it goes down the page.  You can see this to the left where the reference to G3 goes G4, G5, G6 and so on.

How Absolute References Work in Excel

What we want Excel to do is dynamically update the cell reference to column D, but to keep the Commission Rate reference on cell G3. To do this we would use the ‘$’ signs to instruct Excel that this is an absolute reference, like this =D3*$G$3. Then when we copy the formula down the column it will be entered like example on the left here.

Other ways to use absolute references

Make a whole range of cells an absolute reference: $D$1:$F$1

Make only the column absolute $D3

Make only the row absolute D$3

As you can see in the examples above, whatever the ‘$’ sign prefixes is absolute. i.e. as you copy the formula anywhere in the spreadsheet the reference prefixed by the ‘$’ sign will not change.

Shortcut to entering Absolute References

The magical F4 key instantly enters the ‘$’ signs for you.  You can do it while you’re building your formula, or you can go back and edit the formula and enter them.  Of course you can also type them in but it’s quicker to use F4.

Let’s look at the different ways you can enter absolute references using the F4 key in more detail

1)      While you’re building your formula; as you can see below I have started to type a formula into the cell E3.  I have just selected cell G3, as you can see by the marching ants (dashed line) surrounding the cell.

How to enter Absolute References

At this point, before I press enter to finish the formula, I can press the F4 key and Excel will automatically put the ‘$’ signs around G3 for me like this.

F4 key shortcut

2)      Or I can go back to a cell at any time and press the F2 key to edit the cell.  I can then put my cursor anywhere in the cell reference I want absolute and press F4. See below.

F4 key editing shortcut

3)      If you want to absolute a range you have to highlight the cell range like the example below before pressing F4.

applying absolute references

4)      The above examples show you how to apply an absolute reference to the column and the row, but if you keep pressing F4 Excel will scroll through your options. Using =D3*G3 as an example, I want to absolute G3:

a.       With the first press of F4 you will get =D3*$G$3

b.      With the second press of F4 you will get =D3*G$3

c.       With the third press of F4 you will get =D3*$G3

d.      With the fourth press of F4 you will get =D3*G3

So, now you know how Absolute References work in Excel, and how to apply them quickly using the F4 key, you can start to build better spreadsheets that you can dynamically update.

7 0
2 years ago
For his class project, Matt has to create an image in a color scheme that has shade or tint variations of the same hue. Which co
Alex

Answer:

B.Monochromatic

Explanation:

mono means one

5 0
2 years ago
"the ____ criteria filter requires the records displayed to have the specified text string anywhere."
Debora [2.8K]

The contains criteria filter requires the records displayed to have the specified text string anywhere. Thecontains operator is used to perform case-sensitive matching regardless of location in strings.

The begins with criteria filter on the other hand requires the records displayed to start with the specified text string

3 0
2 years ago
Given positive integer numInsects, write a while loop that prints that number doubled without reaching 200. Follow each number w
Gre4nikov [31]

Answer:

numInsects = 16

while numInsects < 200:

   print(str(numInsects) + " ", end="")

   numInsects *= 2

Explanation:

*The code is in Python.

Set the numInsects as 16

Create a while loop that iterates while numInsects is smaller than 200. Inside the loop, print the value of numInsects followed by a space. Then, multiply the numInsects by 2.

3 0
2 years ago
PLEASE HELP PROGRAMMING WILL GIVE BRAINLIEST
JulijaS [17]
The fourth choice is correct.
5 0
2 years ago
Other questions:
  • Which table style option is useful to display aggregated data when it is checked? total row filter button last column header row
    8·1 answer
  • Import java.util.scanner; public class sumofmax { public double findmax(double num1, double num2) { double maxval; // note: if-e
    10·1 answer
  • Mark T for True and F for False. No single person or government agency controls or owns the Internet. The W3C is responsible for
    5·1 answer
  • An administrator has initiated the process of deploying changes from a sandbox to the production environment using the Force IDE
    5·1 answer
  • Write a statement that reads a floating point value from standard input into temperature. Assume that temperature. has already b
    6·1 answer
  • Which use case can be accomplished using a custom link? Choose 3 ans A. Navigate to a process to update the current record. B. N
    10·1 answer
  • Describe the Say It, Cover It, Resay It method.
    14·2 answers
  • Flight Simulation software, which imitates the experience of flying, is often used to train airline pilots. Which of the followi
    10·2 answers
  • Assume you have a variable, budget, that is associated with a positive integer. Assume you have another variable, shopping_list,
    11·1 answer
  • A customer opened a file attachment, and now her PC is infected with ransomware. She's unable to open any of her files. Which ac
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!