I am learning Java, but i am a pythonista.  So please write this code below in python.     Code: public class ABC{          /* Function to reverse arr[] from     start to end*/     static void rvereseArray(int arr[],                     int start, int end)     {         int temp;                    while (start < end)         {             temp = arr[start];             arr[start] = arr[end];             arr[end] = temp;             start++;             end--;         }     }                /* Utility that prints out an     array on a line */     static void printArray(int arr[],                             int size)     {         for (int i = 0; i < size; i++)              System.out.print(arr[i] + " ");                     System.out.println();     }       // Driver code     public static void main(String args[]) {                   int arr[] = {1, 2, 3, 4, 5, 6};         printArray(arr, 6);         rvereseArray(arr, 0, 5);         System.out.print("Reversed array is \n");         printArray(arr, 6);              } }

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 8SA
icon
Related questions
Question

I am learning Java, but i am a pythonista.  So please write this code below in python.

 

 

Code:

public class ABC{
     
   /* Function to reverse arr[] from
    start to end*/
    static void rvereseArray(int arr[],
                    int start, int end)
    {
        int temp;
          
        while (start < end)
        {
            temp = arr[start];
            arr[start] = arr[end];
            arr[end] = temp;
            start++;
            end--;
        }
    }    
      
    /* Utility that prints out an
    array on a line */
    static void printArray(int arr[],
                            int size)
    {
        for (int i = 0; i < size; i++)
             System.out.print(arr[i] + " ");
          
         System.out.println();
    }
 
    // Driver code
    public static void main(String args[]) {
         
        int arr[] = {1, 2, 3, 4, 5, 6};
        printArray(arr, 6);
        rvereseArray(arr, 0, 5);
        System.out.print("Reversed array is \n");
        printArray(arr, 6);
        
    }
}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Declaring and Defining the Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning