About 50 results
Open links in new tab
  1. How to explain the int() function to a beginner - Stack Overflow

    Oct 25, 2017 · The third use case, "convert the string representation of a floating point number to an int " is not covered by the spec, because the language designers decided not to cover it. Which seems …

  2. Can you explain how int function(int()) works in Python?

    Feb 6, 2025 · Are you asking how it's possible to parse an int from a string, or are you asking for the source code to Python's built-in int function?

  3. python int ( ) function - Stack Overflow

    Aug 19, 2012 · 1 Use float () in place of int () so that your program can handle decimal points. Also, don't use next as it's a built-in Python function, next (). Also you code as posted is missing import sys and …

  4. What does -> mean in Python function definitions?

    Jan 17, 2013 · It's a function annotation. In more detail, Python 2.x has docstrings, which allow you to attach a metadata string to various types of object. This is amazingly handy, so Python 3 extends the …

  5. Converting String to Int using try/except in Python

    Nov 10, 2011 · So I'm pretty stumped on how to convert a string into an int using the try/except function. Does anyone know a simple function on how to do this? I feel like I'm still a little hazy on string and i...

  6. python - why does "int" come before "input"? I would like to …

    Jan 8, 2024 · I would like to understand why the function: "int" comes first than "input" I expected the "input" function to be first than the "int" function since "input" has the function of requesting …

  7. How do Python functions handle the types of parameters that you pass …

    Apr 7, 2017 · Python doesn't know that you are calling the function with the proper types, and expects the programmer to take care of that. If your function will be called with different types of parameters, …

  8. What is the difference between int() and floor() in Python 3?

    5 Rounding down can be done in many ways, some methods are equivalent, e.g. built-in int, numpy.trunc and numpy.fix which truncate the number, meaning for a negative number they return a …

  9. Python: is 'int' a type or a function? - Stack Overflow

    In Python, the types have associated functions of the same name, that coerce their argument into objects of the named type, if it can be done. So, the type int <type 'int'> has a function int along with it.

  10. python - Checking whether a variable is an integer or not - Stack …

    Aug 17, 2010 · This adheres to Python's strong polymorphism: you should allow any object that behaves like an int, instead of mandating that it be one. BUT The classical Python mentality, though, is that it's …