About 702,000 results
Open links in new tab
  1. How to define default value if empty user input in Python?

    Here I have to set the default value if the user will enter the value from the keyboard. Here is the code that user can enter value: input = int(raw_input("Enter the inputs : ")) Here the value wi...

  2. python - How do you use input function along with def function?

    Jun 9, 2015 · When you called your function, you never assigned the value to a variable, so it has been wasted. Also, are you using Python 3 or 2.7? In python 3 using input() will return a string, and to …

  3. Python - How to take user input and use that in function

    Jun 18, 2016 · Python - How to take user input and use that in function Asked 9 years, 6 months ago Modified 1 year, 10 months ago Viewed 33k times

  4. python - Creating if/else statements dependent on user input - Stack ...

    I'm trying to create a simple script that will will ask a question to which the user will input an answer (Or a prompt with selectable answers could appear?), and the program would output a response based on …

  5. python - is it possible to use input () in the body of a function ...

    Oct 28, 2021 · It's fine to use input inside a function. The key is to decide which function input should be used in. It would be better to separate the pure computation from the "impure" I/O. And why are you …

  6. How can I limit the user input to only integers in Python

    Creae a helper function which tries to convert an input string by int (input_string) to int and on exception of value errror , again take input.

  7. python - How to stop the input function from inserting a new line ...

    An alternative to backtracking the newline is defining your own function that emulates the built-in input function, echoing and appending every keystroke to a response variable except Enter (which will …

  8. python - Getting a hidden password input - Stack Overflow

    The function secure_password_input() returns the password as a string when called. It accepts a Password Prompt string, which will be displayed to the user to type the password

  9. How do I use raw_input in Python 3? - Stack Overflow

    Jun 5, 2009 · As others have indicated, the raw_input function has been renamed to input in Python 3.0, and you really would be better served by a more up-to-date book, but I want to point out that there …

  10. python - How can I read inputs as numbers? - Stack Overflow

    Dec 8, 2013 · In Python 3.x, raw_input was renamed to input and the Python 2.x input was removed. This means that, just like raw_input, input in Python 3.x always returns a string object.