2

I cannot output in python

I have tried using the output statement-doesn't work, I cannot find a solution in the python documentation other than the print statement-but I do not want to print the "output" on a piece of paper.

kilometers = 5.5
conv_fac = 0.621371    

miles = kilometers * conv_fac
output('%0.3f kilometers is equal to %0.3f miles' %(kilometers,miles))

I want the code to output the correct answer in the Python shell but it does not work

1
  • 1
    First of all, print does not print the output on a piece of paper. Just use print, it writes to standard output, which is your shell. Commented Jun 9, 2019 at 9:46

2 Answers 2

1

print "prints" to the standard output, I believe that's what you're looking for:

print('%0.3f kilometers is equal to %0.3f miles' %(kilometers, miles))
Sign up to request clarification or add additional context in comments.

Comments

0

We use the print() function to output data to the standard output device (screen).

kilometers = 5.5
conv_fac = 0.621371    

miles = kilometers * conv_fac
print('%0.3f kilometers is equal to %0.3f miles' %(kilometers,miles))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.