About 2,970,000 results
Open links in new tab
  1. python - How to assign user input to a variable or list - Stack Overflow

    Feb 27, 2017 · All I want to do is be able to store user input as separate elements in a list or variable so that input with words separated by a space would become separate elements in a variable. Is this clear enough? I am using Python 3.0. How about using str.split (): This creates a list of each space-separated word in the input.

  2. python - setting user input to variable name - Stack Overflow

    Apr 23, 2015 · I am using python and would like to know if it would be possible to ask the user for the name of a variable and then create a variable with this name. For example: my_name = input ("Enter a variabl...

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

  4. Asking the user for input until they give a valid response

    Apr 25, 2014 · You can make the input statement a while True loop so it repeatedly asks for the users input and then break that loop if the user enters the response you would like.

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

    To ask for user input until they give valid input, use an endless while loop with some error handling. For example, let’s create a program that asks the user’s age.

  6. Python program to create dynamically named variables from user input

    Sep 13, 2022 · Given a string input, our task is to write a Python program to create a variable from that input (as a variable name) and assign it to some value. Below are the methods to create dynamically named variables from user input.

  7. Taking input in Python - GeeksforGeeks

    Jan 2, 2025 · For example, Python provides a built-in function called input which takes the input from the user. When the input function is called it stops the program and waits for the user’s input. When the user presses enter, the program resumes and returns what the user typed.

  8. Variables and user input in python – allinpython.com

    In this post, you will learn what are variables and how to take input from the user in Python with very basic explanation and examples, So let’s start learning both concepts one by one. A Variable is a container that holds or stores the value of particular datatypes.

  9. Python Variables and User Input: A Beginner's Guide

    Jul 1, 2023 · Variables and user input play a crucial role in making Python programs more interactive and adaptable. Understanding how to declare variables and take user input allows you to create dynamic applications that respond to user interactions.

  10. Python User Input from Keyboard - input() function - AskPython

    Jul 8, 2019 · Python user input from the keyboard can be read using the input () built-in function. The input from the user is read as a string and can be assigned to a variable.

  11. Some results have been removed
Refresh