0

Hey I am new to programming so sorry if I am dumb.

print("1st number")
a = input()
print("2nd number")
b = input()
s = (a ++ b) 
print(s)

If I put 1 in for both numbers it outputs 11 not 2

  • Note that you do not have to `print("prompt")` and then use `input()` as input itself accept prompt as it argument, i.e. you can do `a = input("1st number")` – Daweo Jul 24 '20 at 14:50

1 Answers1

1

You need to cast the input string to a number:

print("1st number")
a = input()
print("2nd number")
b = input()
s = float(a) + float(b) 
print(s)

or int() for an integer casting.

bp7070
  • 312
  • 2
  • 7