input_output/quickref.tex
author anand
Mon, 15 Nov 2010 14:54:10 +0530
changeset 502 8ca74cb15807
parent 329 5c8e88276e1f
permissions -rw-r--r--
checklist not ok; 5 short answer questions and 2 long answer questions are to be included.
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