About 6,980,000 results
Open links in new tab
  1. 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: I know it can be done using a dictionary but I would like to know whether this is possible without creating an additional object. I am using python 3. Thanks.

  2. Python Variable Assignment: A Comprehensive Guide

    Apr 22, 2025 · Understanding how to assign variables correctly is crucial for writing effective Python code. This blog post will explore the basics of variable assignment in Python, its usage methods, common practices, and best practices.

  3. Assigning Values to Variables - GeeksforGeeks

    Jul 4, 2024 · Below are the steps and methods by which we can assign values to variables in Python and other languages: Direct Initialization Method Using Conditional Operator

  4. Variables in Python: Usage and Best Practices – Real Python

    Jan 12, 2025 · You create a Python variable by assigning a value using the syntax variable_name = value. By the end of this tutorial, you’ll understand that: Variables in Python are symbolic names pointing to objects or values in memory. You define variables by assigning them a value using the assignment operator.

  5. Python Variables - W3Schools

    Variables are containers for storing data values. Python has no command for declaring a variable. A variable is created the moment you first assign a value to it. Variables do not need to be declared with any particular type, and can even change type after they have been set.

  6. Python Variables – The Complete Beginner's Guide

    Mar 22, 2023 · Assigning a value to a variable in Python is an easy process. You simply use the equal sign = as an assignment operator, followed by the value you want to assign to the variable. Here's an example:

  7. Python Variables: A Beginner's Guide to Declaring, Assigning, …

    Just assign a value to a variable using the = operator e.g. variable_name = value. That's it. The following creates a variable with the integer value. In the above example, we declared a variable named num and assigned an integer value 10 to it. Use the built-in print () function to display the value of a variable on the console or IDLE or REPL.

  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. How to assign a variable in Python

    May 1, 2023 · You can set the value of a variable in Python by using the equals sign (=) to make an assignment statement.

  10. How To Assign Values To Variables In Python? - Flexiple

    Mar 19, 2024 · Assigning values to variables in Python using a conditional operator allows for more dynamic and flexible value assignments based on certain conditions. This method employs the ternary operator, a concise way to assign values based on a condition's truth value.

  11. Some results have been removed
Refresh