0
Which is the correct way of performing basic arithmetic operation in python. X=4 Y=2 A. print('addition'+str(x+y)) B.print(x+y)
17 Respuestas
+ 1
Your post is incomplete, please edit it properly. Move the code and multiple choices to the Description, where you can type more freely.
+ 1
print( x + y )
# basic arithmetic result
print( "addition " + str( x + y ) )
# string concatenation and number to string conversion
0
I mean..
From the two options given below, which is the correct way of performing basic arithmetic operation in python (a or b).why?
a. Print('addition'+str(x+y))
b.print(x+y)
0
Apart from the uppercase letter 'P' in `print` for option A (syntax error) ...
It depends, whether you were instructed to print the "addition" word or not. Both does the same calculation, so the question is, do you have to print the "addition" word.
Is this in relation to the courses?
0
Uppercase 'P' is typing mistake...it's lowercase 'p'...
Here the the question is which one is basic arithmetic operation?
Yes sir...this is in relation to the courses...our tutor has given this question.
0
Well, in that case, I'm going for option B, because printing "addition" adds some point to the sense of "basic arithmetic". It involves string concatenation and number to string conversion.
0
Thank you very much 😊
Looking for more support here after
0
No problem 👌
As future reference, please follow the below guide for posting a question. This community is helpful if we do things as expected 👍
https://www.sololearn.com/Discuss/333866/?ref=app
0
You mean B is correct..
0
I *assume* B was the right choice ...
0
Will you help me with giving strong reason
0
👍
0
B is the correct one.....
0
Variable name should start with lowercase... then options B will work fine.
0
Can please help me identifying python keyword.
0
What is python keyword