0

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?

Talha Tayyab
  • 8,111
  • 25
  • 27
  • 44

1 Answers1

1

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

Talha Tayyab
  • 8,111
  • 25
  • 27
  • 44