0

Not getting correct output

https://code.sololearn.com/csLUiHLhhgAv/?ref=app Please have a look and suggest where I am missing

31st May 2020, 12:47 PM
Neeraj Sharma
Neeraj Sharma - avatar
8 odpowiedzi
+ 5
Neeraj Sharma Write this end='\n c = ' to print in new line. # new practice a=int(input("enter value of a ")) print(a) b=int(input("enter value of b ")) print(b) c = a + b print("addition of a and b is", end='\n c = ') print(c)
31st May 2020, 1:04 PM
A͢J
A͢J - avatar
+ 2
Why did you put end="a"? It will then print this letter at the end.
31st May 2020, 12:53 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
You can simply do it by: print("addition of a and b is", c) or: print(f"addition of a and b is {c}") end= parameter will print its value in the end. So theoretically, you could do it like end=c, but without quote signs. It would work. It's just not very Pythonic :)
31st May 2020, 1:19 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
My friend end='c' means that last symbol of printed steing will be 'c' symbol but not your value. Change your 2 last strings to the print('result is: ' , c)
31st May 2020, 1:07 PM
george
george - avatar
+ 1
Hello Neeraj Sharma, you have end = \nc. So print you text more the letter c in other line. Check my code, I hope Help u. https://code.sololearn.com/cGV4hTGAinFM/?ref=app
31st May 2020, 1:39 PM
Josshual A. Toro M.
Josshual A. Toro M. - avatar
0
Kuba Siekierzyński i have corrected that and changed to end=“c” to print the out however still getting the wrong out put.
31st May 2020, 1:03 PM
Neeraj Sharma
Neeraj Sharma - avatar
0
Kuba Siekierzyński as fact 1000 different posibilities exists to print this value c ))))))))).
31st May 2020, 1:21 PM
george
george - avatar
0
You can get the two values in one input: a,b = input("enter value a space then value b\n").split() print(a) print(b) c = int(a)+int(b) print(c)
31st May 2020, 9:37 PM
Yassir
Yassir - avatar