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
Mandarinka [93]
3 years ago
14

Write a function called reverse Return that is almost the same job as reverse, but instead of printing the letters straight to t

he screen, it returns a String in which the letters have been reversed. The function call would look like:
Computers and Technology
1 answer:
vekshin13 years ago
8 0

Answer:

The function in Python is as follows:

def reverse(inputstr):  

   outputstr = ""

   for i in inputstr:

       outputstr = i + outputstr

   return outputstr

Explanation:

This defines the function

def reverse(inputstr):

This initializes the output string

   outputstr = ""

This iterates through the input string

   for i in inputstr:

This generates the output string by reversing the input string

       outputstr = i + outputstr

This returns the reversed string

   return outputstr

You might be interested in
Write a method called compress that takes a string as input, compresses it using rle, and returns the compressed string. case ma
MaRussiya [10]
<span>public static String compress (String original) { StringBuilder compressed = new StringBuilder(); char letter = 0; int count = 1; for (int i = 0; i < original.length(); i++) { if (letter == original.charAt(i)) { count = count + 1; } else { compressed = count !=1 ? compressed.append(count) : compressed; compressed.append(letter); letter = original.charAt(i); count = 1; } } compressed = count !=1 ? compressed.append(count) : compressed; compressed.append(letter); return compressed.toString(); }</span>
5 0
4 years ago
Which is a characteristic of vector images? A. They have a large file size and occupy a lot of space. B. They can be resized wit
Naddik [55]

B (They can be resized without losing image clarity)

4 0
3 years ago
In 25 words or fewer, identify what calendar feature the recurring task function copies.
alexdok [17]
Shhsnanwnwnsjssnsnnwnsn
7 0
3 years ago
(Java) I need help understanding what to code for these methods.
Nuetrik [128]

Answer:

public Mysring(char[] Original)

{

        int size= Original.length();

       for(int i=0;i<=size;i++)

       {

           arr[i]=Original[i];

       }

}

Public Mystring(String Original)

{

  char[] arr=String.toCharArray();

}

Public Mystring(Mystring Original)

{

   Int len=Original.arr.length();

   for(int i=0;i<=len;i++)

   {

        arr[i]=Orginal.arr[i];

   }

}

public int length()

{

    Int len=arr.length();

   return len;

}

Public char charAt(int index)

{

     try

     {

      System.out.println(arr[index]);

     }

     catch(IndexOutOfBoundsException ex)

     {

          throw ex;

     }

}

   

}

Explanation:

1) The first one is the Parameterized constructor. It takes an array of character as input, and assigns it to the array of character which is a field in the given class MyString.

2) The second one is also the Parameterized constructor, and it takes a string as input, and converts it to an array of characters, and finally assigns it to the character type field of the class MyString.

3) The third one is the copy constructor, and takes a previous object of the class as input, and assigns its values to the new instance of the class.

4) The fourth function returns the length of the character field of the class MyString.

5) The fifth function returns the character in the character field at the given index. And if Index is more than the length of the arr field, it through the IndexOutOfBoundsException.

7 0
4 years ago
Carl wants to add a new slide to his PowerPoint presentation. Which option should he use?
djverab [1.8K]

Answer:

C on edg

Explanation:

I just took the review

8 0
4 years ago
Read 2 more answers
Other questions:
  • When saving a document or drawing, you determine the destination folder in which the file will be saved by?
    6·1 answer
  • What instruments are used the measure voltage, current, and resistance
    7·1 answer
  • A cyber community is different than a physical community because _________________. A.people can go to restaurants to meet frien
    13·1 answer
  • One out of how many people in the world has a Fac3book account?
    8·1 answer
  • A particular problem is currently not able to be practically solved by using an algorithm. Which of the following statements abo
    13·2 answers
  • What is the function of HTML?
    13·2 answers
  • Computer __ is any part of the computer that can be seen and touched​
    6·1 answer
  • Which of the following statements is true of subroutines? Check all that apply.
    15·2 answers
  • In the Business world people are often measured by their???
    14·1 answer
  • You are querying a database of manufacturing company suppliers. The column name for supplier identification numbers is supplier_
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!