diff options
Diffstat (limited to 'input_output/quickref.tex')
-rw-r--r-- | input_output/quickref.tex | 20 |
1 files changed, 12 insertions, 8 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|} |