About 530,000 results
Open links in new tab
  1. python - How do you use input function along with def function?

    Jun 9, 2015 · Define a function smaller_num that takes in two numbers to determine and return the smaller number of the two. Ask user for two numbers Use the function to determine the …

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

    Feb 4, 2024 · In Python 2, you should accept user inputs with raw_input(): Check this. x=int(raw_input("Enter first number")) y=int(raw_input("Enter second number")) Please follow a …

  3. python - Using user input to call functions - Stack Overflow

    Sep 19, 2012 · Hi Jon, command becomes a string as soon as it gets input, and you cannot make a function call out of it. Hence, Python tells you 'str' object is not callable What you could do is …

  4. How do I use user input to invoke a function in Python?

    May 18, 2013 · When you use this module every function named do_* will be called when the user inputs the name without the do_. Also a help will be automatically generated and you can pass …

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

    Tasks are intended for building your application. Since Python is interpreted, you don't need to use tasks.json at all to run/debug your Python code. Use the launch.json instead. I am using …

  6. python - Input inside a Function - Stack Overflow

    Oct 10, 2017 · Use of symbols and/or numbers are not allowed.\n") return un def FPassword(): while True: #Comment this out if you want to declare it globally. pw=input("Enter Password ( …

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

  8. python - How to read keyboard input? - Stack Overflow

    The problem is that it is only supported in Python 3. As @sharpner answered, for older versions of Python (2.x), you have to use the function raw_input: nb = raw_input('Choose a number: ') If …

  9. Python input() function - Stack Overflow

    Nov 11, 2016 · On Python 2, input() attempts to coerce the value to a natural Python value, so if the user inputs [1, 2], input() will return a Python list. This is a bad thing, as you will still need …

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

    Oct 28, 2021 · As the other comments already stated, there is no problem in using input inside a function. Note: Other people mention functional programming, but if you're teaching Python …