Tom Tom
Tom Tom

Reputation: 37

How to output in Python

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

Upvotes: 2

Views: 54

Answers (2)

Shivani Sonagara
Shivani Sonagara

Reputation: 1307

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))

Upvotes: 0

Mureinik
Mureinik

Reputation: 311163

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))

Upvotes: 1

Related Questions