About 954,000 results
Open links in new tab
  1. 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, …

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

    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 …

  3. 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...

  4. 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, 11 months ago Viewed 33k times

  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. …

  6. Visual Studio Code - input function in Python - Stack Overflow

    I am trying out Visual Studio Code, to learn Python. I am writing a starter piece of code to just take an input from the user, say: S = input ("What's your name?

  7. 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

  8. 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 …

  9. python - How to test a function with input call? - Stack Overflow

    I have a console program written in Python. It asks the user questions using the command: some_input = input ('Answer the question:', ...) How would I test a function containing a call to …

  10. What's the difference between `raw_input()` and `input()` in Python …

    Jan 31, 2020 · In Python 2, raw_input() returns a string, and input() tries to run the input as a Python expression. Since getting a string was almost always what you wanted, Python 3 does …