About 75,100 results
Open links in new tab
  1. How to return an int value from a function python

    By using "return" you can return it out of the function. In addition you can specifie the datatype. For Example: def myFunction(myNumber): myNumber = myNumber + 1 return int(myNumber) …

  2. Python return statement - GeeksforGeeks

    Dec 10, 2024 · Let’s explore python return statement in detail: def function_name (parameters): # Function body. return value. When the return statement is executed, the function terminates …

  3. The Python return Statement: Usage and Best Practices

    In this tutorial, you’ll learn that: You use return to send objects from your functions back to the caller code. You can use return to return one single value or multiple values separated by …

  4. python - Return string and int from a function - Stack Overflow

    Jan 24, 2016 · How do I return str and int? This is the code (I am using python): ''' order is a string containing words for the items a customer can order. returns the number of times each word is …

  5. How to return an integer in a python function? - Stack Overflow

    May 20, 2020 · It works just that if you want to visualize it use print(): It is returning the value, just that you're not printing it. if (a%2==0): print("2") else: print("1") Or maybe something like this. if …

  6. Python Return Integer From Function – Be on the Right Side

    Oct 24, 2022 · To return an integer, use the built-in int() function. Or create your own function with an arbitrary expression within the function body to compute the integer. Put the result behind …

  7. Python int() Function - GeeksforGeeks

    Mar 19, 2025 · In this example, we passed a string as an argument to the int () function and printed it. Output: The syntax of the int () function in Python is as follows: x [optional]: string …

  8. Python return Statement - AskPython

    May 11, 2023 · In Python, the return statement exits a function and returns the specified value to the caller. Multiple return statements may exist in a function, but only the one that fulfils the …

  9. Python Function Return Type: A Comprehensive Guide

    Apr 5, 2025 · Understanding function return types is crucial as it impacts how functions interact with other parts of the codebase, how data is passed around, and the overall readability and …

  10. Python int() (With Examples) - Programiz

    In this tutorial, you will learn about the Python int () function with the help of examples.The int () method returns an integer object from any number or string.

  11. Some results have been removed