+ 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)

10th Feb 2022, 5:44 AM
Zixuan Zhou(hins)
Zixuan Zhou(hins) - avatar
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.
10th Feb 2022, 5:53 AM
Simba
Simba - avatar
+ 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())
10th Feb 2022, 5:53 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 2
wow it works thanks!
10th Feb 2022, 6:02 AM
Zixuan Zhou(hins)
Zixuan Zhou(hins) - avatar
+ 1
You're welcome :)
10th Feb 2022, 6:11 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 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)
11th Feb 2022, 4:49 PM
Mohammad al ayoubi
Mohammad al ayoubi - avatar