0
Not getting correct output
https://code.sololearn.com/csLUiHLhhgAv/?ref=app Please have a look and suggest where I am missing
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)
+ 2
Why did you put end="a"? It will then print this letter at the end.
+ 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 :)
+ 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)
+ 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
0
Kuba Siekierzyński i have corrected that and changed to end=“c” to print the out however still getting the wrong out put.
0
Kuba Siekierzyński as fact 1000 different posibilities exists to print this value c ))))))))).
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)