input_output/quickref.tex
author Nishanth <nishanth@fossee.in>
Tue, 12 Oct 2010 11:26:09 +0530
changeset 334 4b1e81da1c80
parent 329 5c8e88276e1f
permissions -rw-r--r--
Finished using_sage_to_teach
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
329
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
     1
Printing a variable:\\
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
     2
{\ex \lstinline|    print x|}
236
33828497b5da Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     3
329
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
     4
Printing with out a new line:\\
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
     5
{\ex \lstinline|    print x, |}
236
33828497b5da Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     6
329
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
     7
Using modifiers while printing:\\
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
     8
{\ex \lstinline|    print "a is \%d b is \%f"\%(a, b)|}
236
33828497b5da Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     9
329
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
    10
Taking input from user:\\
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
    11
{\ex \lstinline|    x = raw_input()|}
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
    12
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
    13
Display a prompt while taking input:\\
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
    14
{\ex \lstinline|    x = raw_input("Type a number: ")|}
5c8e88276e1f input_output is now complete
Nishanth <nishanth@fossee.in>
parents: 236
diff changeset
    15