About 3,310,000 results
Open links in new tab
  1. Python Variable Declaration - Stack Overflow

    Jun 13, 2012 · As of Python 3, you can explicitly declare variables by type. For instance, to declare an integer one can do it as follows: x: int = 3 or: def f(x: int): return x see this question …

  2. How to declare variable type, C style in Python - Stack Overflow

    Oct 14, 2010 · How do I declare data types for variables in python like you do in C. ex: int X,Y,Z; I know I can do this in python: x = 0 y = 0 z = 0 But that seems a lot of work and it misses the …

  3. How do I create a constant in Python? - Stack Overflow

    Apr 21, 2010 · In Python, constants do not exist, but you can indicate that a variable is a constant and must not be changed by adding CONST_ to the start of the variable name and stating that …

  4. Do variables have to be defined in Python before use?

    Mar 31, 2023 · You said "call a variable", but if you meant "assign to a variable", then yes, in python, as in PHP, the variable will be created dynamically. – prelic Commented Apr 13, 2012 …

  5. How do I declare an array in Python? - Stack Overflow

    Oct 3, 2009 · @AndersonGreen As I said there's no such thing as a variable declaration in Python. You would create a multidimensional list by taking an empty list and putting other lists …

  6. How do I use a Boolean in Python? - Stack Overflow

    Mar 16, 2018 · When you type True, python memory manager will check its address and will pull the value '1'. for False its value is '0'. Comparisons of any boolean expression to True or False …

  7. python - How can I use a global variable in a function? - Stack …

    Jul 11, 2016 · If you declare a variable outside the brackets, it become global (accessible to all functions and other brackets). If you declare a variable inside the brackets, it become local …

  8. Should you declare variable before hand in python when using list ...

    Nov 11, 2020 · Well, python doesn't know that what you want in the box is an int. Maybe you wanted a fraction, a complex number, or something you make up yourself that happens to be …

  9. Is it possible only to declare a variable without assigning any value ...

    Mar 20, 2009 · I'm not sure what you're trying to do. Python is a very dynamic language; you don't usually need to declare variables until you're actually going to assign to or use them. I think …

  10. correct way to define class variables in Python - Stack Overflow

    @Lobotomik: I believe it is only "shadowing" the class variable, since you can still access the unmodified class variable via c1.__class__.static_elem. Your words "static_elm will become …

Refresh