5*2=55 not 10! Why?

Question:

I want to output 5 * 2 = 10 but python output is 55!
How do I resolve this problem?

a = 0
b = 2

a = input("a? :") #(get 5 as input)

c = a * b

print (c)

This is my code.
when I input a number it repeat same number I entered two times insterd of showing multipiy it. What do I have to do to solve this?

Asked By: Tharindu Thathsara

||

Answers:

a is a string,

so it will be

'5'*2='55'

if you want 10, you need to cast a to int.

a=int(input())

here is the link to document

https://docs.python.org/3/library/functions.html#input

Answered By: God Is One
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.