When i click run in Juptyer notebook to see my output it has an empty space where i didn’t enter input for this case it’s in the Entered_Value, now I am new to coding and want to ask how can i fix this, note that i do not want a whole new code just how to fix my problem,
Further more the output for example : num _1 = 30 and num _2 = 15 ope = –
, should come out as only 15 without the space , For the input : num_1=30 and num_6 and ope=% and Entered_Value=A the output is
30
6
%
Invalid Operator
Entered Value: A
The output I am seeking is for example 1 mentioned above to be :
15
and not (space in between):
(space)
15
My code:
num_1 = int(input())
num_2 = int(input())
ope = input()
Entered_Value = input()
result_add = ((ope == '+') and num_1 + num_2 )
result_sub= ((ope == '-') and num_1 - num_2 )
result = result_add or result_sub or f"Invalid OperatornEntered_Value:{Entered_Value}"
print(result)
Malka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3