- 2
Write a program to take two integers as input and output their sum.
This is my question. This program adds two numbers num1 = 1.5 num2 = 6.3 # Add two numbers sum = num1 + num2 # Display the sum print('The sum of {0} and {1} is {2}'.format(num1, num2, sum)). I used this method. And it shows incorrect. Tell me the crct method
6 ответов
+ 8
num1 = 1.5
num2 = 6.3
sum = num1 + num2
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
Your code is fine. But read the task and its expected output. It should be matched. Then only you can complete the task.
You can't give inputs by yourself it should be asked
Try it again
Edit:
harini Sree Can we see that code?
+ 2
The question says ‚output the sum’ but you output a lot more. you should only output the sum, not anything else.
0
No it's just a sample I've given the correct input.
0
reminds me of this: https://xkcd.com/221/