-4

i was making a program to add the numbers of two given input but the number am giving they are getting joined instead of getting added, below is my code.

print("enter 1st no.")
no1 = input(int())

print("enter 2nd no.")
no2 = input(int())

print (int(no1 ++ no2))

i putted 1 and 2 in the input and am getting result as 12 instead of 3 please help me.

ADDY
  • 1
  • 1

2 Answers2

1

Use int(input()) not input(int()):

print("enter 1st no.")
no1 = int(input())

print("enter 2nd no.")
no2 = int(input())

print(no1 + no2)
Lecdi
  • 2,189
  • 2
  • 6
  • 20
0
No1 = int(input())
No2 = int(input())

print(No1 + No2)
bb1
  • 7,174
  • 2
  • 8
  • 23
Gedas Miksenas
  • 959
  • 7
  • 15
  • 1
    `Print()`, really? – buran Dec 12 '21 at 17:14
  • Sorry, typing with phone and thus capitalized ;) print() – Gedas Miksenas Dec 12 '21 at 17:30
  • 1
    You can fix it, please also format the answer correctly, and add some context on *why* this is the solution and how this is different from the answer already posted. – S3DEV Dec 12 '21 at 17:53
  • I suggest to follow the naming conventions from the [Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/#naming-conventions), so `No1` and `No2` should be `no1` and `no2` (or even better `number1` and `number2`). – Matthias Dec 12 '21 at 20:43