How to handle 1/3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to handle 1/3

i got "No output" as result

5th Nov 2016, 3:46 AM
Dinesh Devaki
Dinesh Devaki - avatar
5 Answers
+ 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
5th Nov 2016, 7:03 AM
Kirk Schafer
Kirk Schafer - avatar
+ 1
cant i use just 1/3 directly with out print statement
5th Nov 2016, 4:19 AM
Dinesh Devaki
Dinesh Devaki - avatar
0
x = 1/3 print(x) Output: 0.3333333333333333 What was your code?
5th Nov 2016, 4:05 AM
-- -- --
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.
5th Nov 2016, 4:23 AM
-- -- --
0
if you don't want to print the answer you can print it as an string print("1/3")
5th Nov 2016, 4:38 AM
Hamidreza Bayat
Hamidreza Bayat - avatar