About 20,800,000 results
Open links in new tab
  1. How can I return two values from a function in Python?

    I would like to return two values from a function in two separate variables. What would you expect it to look like on the calling end? You can't write a = select_choice(); b = select_choice() …

  2. What is a DEF function for Python - Stack Overflow

    Sep 10, 2013 · I am new to coding Python and I just can't seem to understand what a Def function is! I have looked and read many tutorials on it and I still don't quite understand. Can somebody …

  3. python - Error: Invalid Syntax on "def" - Stack Overflow

    Jan 16, 2014 · Error: Invalid Syntax on "def" Asked 14 years, 1 month ago Modified 11 years, 7 months ago Viewed 31k times

  4. python - What does def main () -> None do? - Stack Overflow

    As is, it does absolutely nothing. It is a type annotation for the main function that simply states that this function returns None. Type annotations were introduced in Python 3.5 and are specified …

  5. How do I call a function from another .py file? [duplicate]

    First, import function from file.py: from file import function Later, call the function using: function(a, b) Note that file is one of Python's core modules, so I suggest you change the filename of …

  6. How can I use a global variable in a function? - Stack Overflow

    Jul 11, 2016 · How do I create or use a global variable inside a function? How do I use a global variable that was defined in one function inside other functions? Failing to use the global …

  7. Explaining Python's '__enter__' and '__exit__' - Stack Overflow

    I saw this in someone's code. What does it mean? def __enter__(self): return self def __exit__(self, type, value, tb): self.stream.close() Here is the complete code. from

  8. Groovy: what's the purpose of "def" in "def x = 0"?

    Oct 9, 2008 · Using the def keyword in larger programs is important as it helps define the scope in which the variable can be found and can help preserve encapsulation. If you define a method …

  9. How can I change a global variable from within a function?

    Like this: def test(): global a a = a + 10 print(a) Using the global keyword just tells the test where to look for a. With the first method, you can't modify the global variable a, because you made a …

  10. How to call a async function from a synchronized code Python

    Aug 9, 2018 · So I'm locked to a python 3.6.2 interpreter that follows my desktop application. What I want is to call an async function from a synchronized method or function. When calling …