+ 1
How to handle 1/3
i got "No output" as result
5 Respostas
+ 2
Are you using a custom Python interpreter? This is the second post reading "No Output" and the third asking about interactive behavior. Some answers here are incorrect for the standard Python 3 shell:
>>> 1/3
0.33333333333333331
+ 1
cant i use just 1/3 directly with out print statement
0
x = 1/3
print(x)
Output:
0.3333333333333333
What was your code?
0
No you cant, it does process 1/3 but your not doing anything with the output. You would either need to print it, like print(1/3) or set a variable to 1/3 like
x = 1/3.
Its a lot like thinking about the answer of 5+5 but not saying what the answer is, and then print(5+5) is like saying the answer of 5+5.
0
if you don't want to print the answer you can print it as an string
print("1/3")