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 OverflowHow to multiply a variable by an integer?
python - Having trouble with multiplying a variable with a number - Stack Overflow
Python Multiplication Help?
Multiplying in Python Without Using * - Help Please
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?
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.
Your variable number is a string and not an int. So it does a "string multiplication". Try casting number to int or float.
number = int (number)
number = float (number)