diff options
Diffstat (limited to 'input_output')
-rw-r--r-- | input_output/quickref.tex | 20 | ||||
-rw-r--r-- | input_output/script.rst | 6 |
2 files changed, 12 insertions, 14 deletions
diff --git a/input_output/quickref.tex b/input_output/quickref.tex index a0212b3..43629ca 100644 --- a/input_output/quickref.tex +++ b/input_output/quickref.tex @@ -1,11 +1,15 @@ -Creating a tuple:\\ -{\ex \lstinline| t = (1, "hello", 2.5)|} +Printing a variable:\\ +{\ex \lstinline| print x|} -Accessing elements of tuples:\\ -{\ex \lstinline| t[index] Ex: t[2]|} +Printing with out a new line:\\ +{\ex \lstinline| print x, |} -Accessing slices of tuples:\\ -{\ex \lstinline| t[start:stop:step]|} +Using modifiers while printing:\\ +{\ex \lstinline| print "a is \%d b is \%f"\%(a, b)|} + +Taking input from user:\\ +{\ex \lstinline| x = raw_input()|} + +Display a prompt while taking input:\\ +{\ex \lstinline| x = raw_input("Type a number: ")|} -Swapping values:\\ -{\ex \lstinline| a, b = b, a|} diff --git a/input_output/script.rst b/input_output/script.rst index e525872..bcac6e9 100644 --- a/input_output/script.rst +++ b/input_output/script.rst @@ -1,17 +1,11 @@ .. Objectives .. ---------- -.. A - Students and teachers from Science and engineering backgrounds - B - - C - - D - - .. #. How to print some value .. #. How to print using modifiers .. #. How to take input from user .. #. How to display a prompt to the user before taking the input - .. Prerequisites .. ------------- |