About 10,200,000 results
Open links in new tab
  1. python - How do I allow a user to input vectors rather than strings ...

    Nov 10, 2016 · I'm trying to make my program allow the user to input vectors of the form (x,y,z) using python's built in input () function. If entered normally in python with out using the input () function it indexes each vector separately. For example, >>> …

  2. How to take a vector input in Python 3? - Stack Overflow

    Apr 7, 2020 · If you really don't want any text there the easiest solution would be list(map(int, input('').split())). Edit: while this fixed the specific example above, input doesn't require a prompt. The input () function requires a prompt as an argument, to show to the user. You just need to fill it in, for example input("Enter a vector")

  3. Vector input from user - python - Stack Overflow

    Mar 2, 2019 · I am trying to get a vector using the input function to do the mathematical operation. Below is the code I am using. Any pointers will help. Thanks, Prashant. exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-109-6cf21e5e043d>", line 1, in <module> vector1=np.array(vectors.split(','),dtype=np.int16)

  4. Python User Input - W3Schools

    Python allows for user input. That means we are able to ask the user for input. The method is a bit different in Python 3.6 than Python 2.7. Python 3.6 uses the input() method. Python 2.7 uses the raw_input() method. The following example asks for the username, and when you entered the username, it gets printed on the screen:

  5. Get a list as input from user in Python - GeeksforGeeks

    Dec 5, 2024 · In this article, we will see how to take a list as input from the user using Python. The input() function can be combined with split() to accept multiple elements in a single line and store them in a list. The split() method separates input based on spaces and returns a list. Output:

  6. Ask for Input in Python: A Comprehensive Guide - CodeRivers

    Apr 8, 2025 · In Python, asking for input from the user means retrieving data that the user types into the console or an input field. This input can be used to control the flow of a program, provide data for calculations, or customize the behavior of an application.

  7. Storing User Input in Python: Best Practices and Examples

    The most basic way to receive user input in Python is through the `input ()` function. This function prompts the user to enter a value and returns whatever they type as a string. Here’s an example: name = input (“What’s your name? “) When run, this …

  8. How To Take Continuous Input In Python?

    Jun 18, 2023 · Taking continuous input in Python means that the program keeps asking the user for input until a certain condition is met. This is typically achieved using loops.

  9. How to Ask for User Input in Python: A Complete Guide

    To ask for user input in Python, use the input () function. For example, to ask a number, user_number = input ("Enter a number: ")

  10. How to Ask for User Input in Python

    What are some best practices when asking for user input in Python? Some best practices include: providing clear instructions, validating and sanitizing user input, handling potential exceptions, and giving feedback to the user.

  11. Some results have been removed
Refresh