+ 1
I need help
I tried two ways and I canât manage to do it it keeps on saying I canât multiply what is wrong: w = input() h = input() d = (w * h) print (d)
5 Answers
+ 7
Input() returns string by default. You need to convert it to an integer using int().
You can't multiply two strings with each other.
+ 4
You can multiply a string with a number, a number with a number, but not a string with a string.
When you take input, it will come as string. To turn it into a number, use int(your_string_here). For example:
w = int(input())
+ 2
wow it works
thanks!
+ 1
You're welcome :)
+ 1
input() will return a string and * must be a number so you should convert in from string to int
w=int(input())
h=int(input())
print(w*h)