Difference between revisions of "Python Printing"

From OpenCircuits
Jump to navigation Jump to search
 
(update to Python3 syntax, so I don't get "SyntaxError: missing parenthesis".)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
  
 
= Overview =
 
= Overview =
Printing generally means putting words and numbers on the computers screen.  Your first program should have been "Hello World" or something similar.  One version is:
+
Printing generally means putting words and numbers on the computer screen.  Your first program should have been "Hello World" or something similar.  One version is:
 
<pre>
 
<pre>
print "Hello World"
+
print( "Hello World" )
 
</pre>
 
</pre>
 
The process can get a bit more complicated when you want to format the output in some special way ( think about the different ways that dates can be printed ) or when you want the output to go to some place other than the Python console.  Often you want to print a string, and manipulating the string is closely related to the process of printing.
 
The process can get a bit more complicated when you want to format the output in some special way ( think about the different ways that dates can be printed ) or when you want the output to go to some place other than the Python console.  Often you want to print a string, and manipulating the string is closely related to the process of printing.
Line 10: Line 10:
 
== Links ==
 
== Links ==
  
*'''[[https://learnpythonthehardway.org/book/ex5.html  Learn Python the Hard Way: Exercise 5: More Variables and Printing]]'''
+
* [https://www.freecodecamp.org/news/print-statement-in-python-how-to-print-with-example-syntax-command/ freeCodeCamp: Print Statement in Python]
 +
* [https://openpython.org/courses/learnpython/lessons/printing-in-python/ Open Python: Printing in Python]
 +
*'''[[https://learnpythonthehardway.org/book/ex5.html  Learn Python the Hard Way: Exercise 5: More Variables and Printing]]''' [FIXME: Broken link?]
 
*'''[[https://learnpythonthehardway.org/book/ex6.html  Learn Python the Hard Way: Exercise 6: Strings and Text]]'''
 
*'''[[https://learnpythonthehardway.org/book/ex6.html  Learn Python the Hard Way: Exercise 6: Strings and Text]]'''
 
*'''[https://learnpythonthehardway.org/book/ex7.html Learn Python the Hard Way: Exercise 7: More Printing]'''
 
*'''[https://learnpythonthehardway.org/book/ex7.html Learn Python the Hard Way: Exercise 7: More Printing]'''
  
 
[[category:Python]] [[category:Python Course]] [[category:Draft]]
 
[[category:Python]] [[category:Python Course]] [[category:Draft]]

Latest revision as of 17:45, 13 November 2025

Overview

Printing generally means putting words and numbers on the computer screen. Your first program should have been "Hello World" or something similar. One version is:

print( "Hello World" )

The process can get a bit more complicated when you want to format the output in some special way ( think about the different ways that dates can be printed ) or when you want the output to go to some place other than the Python console. Often you want to print a string, and manipulating the string is closely related to the process of printing.


Links