<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Basic_input_and_output</id>
	<title>Basic input and output - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Basic_input_and_output"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Basic_input_and_output&amp;action=history"/>
	<updated>2026-05-14T01:15:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=Basic_input_and_output&amp;diff=9246&amp;oldid=prev</id>
		<title>Bernard Szlachta at 19:20, 6 February 2013</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Basic_input_and_output&amp;diff=9246&amp;oldid=prev"/>
		<updated>2013-02-06T19:20:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Cat|Python Commands|0010}}&lt;br /&gt;
{{Python Links}}&lt;br /&gt;
&lt;br /&gt;
== Reading from the text console ==&lt;br /&gt;
User input can be read from the keyboard with or without a message text. The value returned is always a string:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = raw_input()&lt;br /&gt;
a = raw_input(&amp;#039;Please enter a number&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Writing to the text console ==&lt;br /&gt;
The Python print statement is very versatile and accepts almost any combination of strings, numbers, function calls, and arithmetic operations separated by commas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print &amp;#039;Hello World&amp;#039;&lt;br /&gt;
print 3 + 4&lt;br /&gt;
print 3.4&lt;br /&gt;
print ”””Text that stretches over&lt;br /&gt;
multiple lines.”””&lt;br /&gt;
print &amp;#039;number&amp;#039;, 77&lt;br /&gt;
print&lt;br /&gt;
print int(a) * 7&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== String formatting ==&lt;br /&gt;
Variables and strings can be combined, using formatting characters. This works also within a print statement. In both cases, the number of values and formatting characters must be equal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
s = &amp;#039;Result: %i&amp;#039;%(number)&lt;br /&gt;
print &amp;#039;Hello %s!&amp;#039;%(&amp;#039;Roger&amp;#039;)&lt;br /&gt;
print &amp;#039;(%6.3f/%6.3f)&amp;#039;%(a,b)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The formatting characters include:&lt;br /&gt;
&lt;br /&gt;
* %i – an integer.&lt;br /&gt;
* %4i – an integer formatted to length 4.&lt;br /&gt;
* %6.2f – a float number with length 6 and 2 after the comma.&lt;br /&gt;
* %10s – a right-oriented string with length 10.&lt;br /&gt;
&lt;br /&gt;
== Escape characters ==&lt;br /&gt;
&lt;br /&gt;
Strings may contain also the symbols: \t (tabulator), \n (newline), \r (carriage return), and \\ (backslash).&lt;/div&gt;</summary>
		<author><name>Bernard Szlachta</name></author>
	</entry>
</feed>