Skip to content
murmot

Results for “function return python array example code in java programming site:geeksforgeeks.org”

  • geeksforgeeks.org

    Search, Insert, and Delete in an Sorted Array - GeeksforGeeks

    # python 3 program to implement # binary search in sorted array.# Python3 program to implement insert # operation in an sorted array. # Inserts a key in arr[] of given capacity. # n is current size of arr[]. This function # returns n+1 if insertion is successful, else n.

  • geeksforgeeks.org

    Arrays in Java - GeeksforGeeks

    Nov 20, 2026 ... int[] arr = new int[5];. This creates an integer array that can hold five elements. Java automatically initializes array elements with default ...

  • geeksforgeeks.org

    Python Tutorial - GeeksforGeeks

    Python is one of the most popular programming languages. It’s simple to use, packed with features and supported by a wide range of libraries and frameworks. Its clean syntax makes it beginner-friendly. A high-level language used in data science, automation, AI, web development and more.

  • geeksforgeeks.org

    Function With Return - GeeksforGeeks

    Oct 31, 2026 ... Given an integer n, You need to use the return keyword to return twice the value of n. Examples: Input: n = 2. Output: 4. Explanation: 2 * 2 = 4

  • geeksforgeeks.org

    How to split a string in C/C++, Python and Java? - GeeksforGeeks

    For example, we have a comma-separated list of items from a file and we want individual items in an array. Almost all programming languages, provide a function split a string by some delimiter.Auxiliary Space: O(n). In Java : In Java, split() is a method in String class.

  • geeksforgeeks.org

    Java return Keyword - GeeksforGeeks

    Jan 2, 2025 · return keyword in Java is a reserved keyword which is used to exit from a method, with or without a value. The usage of the return keyword can be categorized into two cases: Methods returning a value Methods not returning a value 1. Methods Returning a Value For the methods that define a return type, the return statement must be immediately followed by a return value. Example:

  • geeksforgeeks.org

    How to sort an array in a single loop? - GeeksforGeeks

    # Python3 code to sort an array of integers # with the help of single loop #. Function for Sorting the array # using a single loop def sortArrays(arr): # Finding the length of array 'arr' length = len(arr) #.This code is contributed by Rajput-Ji. Java.

  • geeksforgeeks.org

    Python map() function - GeeksforGeeks

    By default, map() function returns a map object. In many cases, we may need to convert this iterator to a list to work with the results directly. Example: Let's see how to double each element of the given list. Python. def double(val): return val * 2.

  • geeksforgeeks.org

    Returning Multiple values in Java - GeeksforGeeks

    Jul 23, 2025 · Java doesn't support multi-value returns. We can use following solutions to return multiple values. If all returned elements are of same type We can return an array in Java. Below is a Java program to demonstrate the same.

  • geeksforgeeks.org

    Return List from Function - Python - GeeksforGeeks

    Jul 23, 2025 · In Python, functions can return a wide variety of data types and we can return list too. Our task is to return a list from a Python function. We'll do this using different techniques—returning static data, computed values and generator-based lists, through short, clear examples. We can simply construct the list within function and return it.