You want:

number = int(number)

At the moment, 'number' is a string (i.e. '1' rather than 1) so multiplying it by four naturally just gives you '1111'. Using int() will give you an integer representation of the string.

Answer from bluepnume on Stack Overflow
🌐
Quora
quora.com › How-do-you-multiply-two-variables-together-in-the-Python-programming-language
How to multiply two variables together in the Python programming language - Quora
Answer (1 of 4): There are a few ways. The easiest would be to write a print statement such as: print(5 * 7) (or whatever your numbers are to be multiplied, these are just examples.) The output will be 35 If you want variables that you can change and leave code in place to reuse, then write th...
🌐
Maschituts
maschituts.com › multiply-variables-in-python
How to Multiply Variables in Python - Maschituts
February 8, 2024 - If you actually want to multiply numbers and don’t want the repetition, then convert the variable y to an integer using the int() method. x = 3 y = '4' result = x*int(y) print("Result:", result) ...
Discussions

How to multiply a variable by an integer?
Show us your code. There is nothing wrong with what you described so you probably made a small error. That we can't see if you don't share that part of the code. More on reddit.com
🌐 r/learnpython
9
1
June 30, 2021
python - Having trouble with multiplying a variable with a number - Stack Overflow
I don't know this 'droid' kit, but I suspect that it's returning a string from dialogGetInput. If you multiply a string in python by N you get that string N times. ... So your program is seeing the STRING '1', not the integer 1. You need to convert your answer to an integer first: More on stackoverflow.com
🌐 stackoverflow.com
Python Multiplication Help?
The result of input() is string, so you need to convert it to integer if you want an integer instead: num = int(input(...)). Note that you need to cater invalid input, i.e. the user input is not a number, otherwise exception will be raised. More on reddit.com
🌐 r/learnpython
19
5
May 7, 2025
Multiplying in Python Without Using * - Help Please
Explain your understanding of the answer given. If it helps, when you multiply 3 by 5 you want to add 3 five times to zero… 0 + 3 + 3 + 3 + 3 + 3 = 15. Well the 0 in this case is total and i and the while I < abs(b) but are how you make sure you end up adding 3 to total precisely 5 times, no more, no less. The reason abs is there is to ensure you’re counting up to 5 even if you’ve said to multiply by -5… the code then flips the sign of the answer to account for a negative value of b. Make sense? More on reddit.com
🌐 r/learnprogramming
22
1
July 5, 2021
🌐
Altcademy
altcademy.com › blog › how-to-multiply-in-python
How to multiply in Python - Altcademy.com
June 13, 2023 - In Python, the most straightforward way to multiply two numbers is by using the * operator. This operator works with integers, floats, and even complex numbers. Here's a simple example: a = 5 b = 3 result = a * b print(result) # Output: 15 · ...
🌐
Mimo
mimo.org › tutorials › python › how-to-multiply-in-python
How to Multiply in Python
Use *= to multiply and store back into the same variable. Use "text" * n or [item] * n to repeat sequences with an integer. Build 2D lists with a list comprehension to avoid shared rows. Use a list comprehension to multiply every element in a list. ... Become a Python developer.
🌐
Kanaries
docs.kanaries.net › topics › Python › how-to-multiply-python
How to Multiply in Python for Beginners – Kanaries
August 18, 2023 - In the example above, we used an f-string to format the output, which is a convenient way to include variables directly within a string: print(f"The result of the multiplication is {result}") You can learn more about string formatting in Python to enhance your programming skills.
🌐
Reddit
reddit.com › r/learnpython › how to multiply a variable by an integer?
r/learnpython on Reddit: How to multiply a variable by an integer?
June 30, 2021 -

I want to run a function where around 10 variables = input for each variable, and then a few lines later the variables are multiplied by different numbers. As in variable13, variable20.5, etc. In the end, after each variable has been multiplied by its respective number, the totals would all be added together for one grand total.

I keep getting a float integer error each time i try to multiply a variable by a number? The inputs of the variables should only be numbers, and I could add an if else statement to check whether the input is a number or not before proceeding, but what else do I need to do to avoid this error?

🌐
Python Guides
pythonguides.com › multiply-in-python
How to Multiply in Python?
December 12, 2025 - Multiplying numbers in Python is easy. You use the * operator, which works for integers, floats, and even complex numbers. ... I executed the above example code and added the screenshot below. The * operator multiplies the two values and returns the product. You can multiply floats just as ...
Find elsewhere
🌐
Kodeclik
kodeclik.com › how-to-multiply-in-python
How to multiply numbers in Python
June 16, 2025 - There are six ways to multiply in Python. 1. Use the * operator. 2. Use the *= assignment operator. 3. Multiply a list of numbers at once using map(). 4. Use the reduce operation on a list. 5. Use math.prod. 6. Use numpy.multiply.
🌐
4Geeks
4geeks.com › en › how-to › how-to-multiply-in-Python
How to Multiply in Python: Numbers, Strings & Arrays
July 16, 2025 - First we need to import numpy to be able to use it, and then with numpy.prod() we pass the element we want to multiply (in this case, our array of numbers) Lambda is one of the most used methods in the python library, here´s how to use it along with reduce to multiply lists
🌐
YouTube
youtube.com › master code online
Python Functions: Multiplication Function - YouTube
Be sure to like, share and comment to show your support for our tutorials. ======================================= Channel - https://goo.gl/pnKLqE Playlist F
Published: November 25, 2016
Views: 5K
🌐
CodeGenes
codegenes.net › blog › how-to-multiply-variables-in-python
Mastering Variable Multiplication in Python — codegenes.net
In Python, variable multiplication is performed using the * operator. The * operator can be used to multiply numeric variables, as well as to repeat sequences such as strings and lists.
🌐
Programiz PRO
programiz.pro › discuss › python › how-do-you-write-code-to-perform-multiplication
How do you write code to perform multiplication?
To perform multiplication, you'll use the asterisk symbol (*), which serves as the multiplication operator in most programming languages, including Python. Let's update the code you're working with to perform an actual multiplication: ... This ...
🌐
Academic Help
academichelp.net › coding › python › how-to-multiply.html
How to Multiply in Python: A Guide to Use This Function
January 31, 2024 - For example: result = 2 * 6 * 3 * 5 * 7 print(result) # Output: 1260 · To multiply a number by itself, you can use the multiplication operator repeatedly or the exponentiation operator **. For instance:
🌐
CodeGym
codegym.cc › java blog › learning python › multiply in python
Multiply in Python
August 14, 2024 - Python’s flexibility allows for ... interesting ways you can multiply things in Python. The most straightforward method is using a for loop to iterate through the list, multiplying each element with a running product variable....
🌐
IQCode
iqcode.com › code › python › python-multiply-2-variables
python multiply 2 variables Code Example - IQCode.com
October 24, 2021 - num1 = &quot;2&quot; # first variable num2 = &quot;2&quot; # second variable output = num1*num2 # multiplied number # Optional: print multiplied number print(output) ... Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
🌐
A Girl Among Geeks
agirlamonggeeks.com › home › how do you multiply variables in python?
How Do You Multiply Variables in Python?
July 4, 2025 - Whether you’re a beginner just starting your coding journey or an experienced developer brushing up on your skills, mastering this concept will enhance your ability to manipulate data and build dynamic applications. At its core, multiplying variables in Python involves combining values stored in different containers to produce a new result.
🌐
Django Central
djangocentral.com › python-program-to-multiply-two-numbers
Python Program To Multiply Two Numbers
First, the two numbers are stored in the variables num_1 and num_2, respectively. Multiplication in Python is done by ( * ) operator, Then the result is saved in the product variable and printed out using string formatting.
🌐
Araqev
araqev.com › home › how can you multiply variables in python effectively?
How Can You Multiply Variables in Python Effectively?
March 22, 2025 - When it comes to multiplying variables in Python, the process is straightforward yet versatile. Python supports multiplication of different data types, including integers, floats, and even lists, allowing for a wide array of applications.