We get input from user by the "input" keyword. My question is that whenever I try to input a number and then multiply it by any number, like as (say x is any number), and then suppose I do x*2, it displays "xx". When I convert the variable to which I store the input, to an integer, it works fine. Why does the variable does not become an integer, although when we type any number?
You must be logged in to post. Please login or register an account.
Input is just simply always a string, but you can do something like
x = float(input('What num?')) print(x*2)
-Harrison 8 years ago
You must be logged in to post. Please login or register an account.