0
Why i have to write print() then input a numerical operation to work. Writing directly a numerical operation showing error.
why?
15 Answers
+ 2
Can you show the code or give an example?
print(5+3)
Works fine.
+ 2
add a comma and it should work:
print('we get=', 30/11)
+ 1
well, for me it does not show an error
5+3
just gives:
"no output"
which is true - since there is no print statement, there is no output
+ 1
You can...
The issue is how you're writing it.
Show us your code, or write it exactly as I wrote it.
+ 1
On line 8
"print('we get') print(30/11)"
Python is dependant on Indentation, so you cannot have 2 print statements on the same line.
Move it to the next line, like this:
print('we get')
print(30/11)
0
input() returns a string value - maybe that's the reason why retrieved an error? you have to cast the input to integer first
0
directly writing 5+3 is showing error
0
where do you write it?
python prompt?
solo learn playground?
any other IDE?
0
solo learn playground
0
but it says u can write numerical operations without writing print()
0
hey see my code in my profile. it isn't working why?
0
OK thanks
0
hey another thing
print('we get=' 30/11)
it is also not working
0
why? we gat should be treated like text.
also if it is not working. then how should I write
we get= '30/11'
(this 30/11 above is the value after division)
0
hey martin, can't we assign a operations(+,-,*,/) to a variable.