basic_datatypes_and_operators/quickref.tex
changeset 522 d33698326409
child 523 54bdda4aefa5
equal deleted inserted replaced
521:88a01948450d 522:d33698326409
       
     1 \documentclass{article}
       
     2 \begin{Document}
       
     3 \begin{center}
       
     4 \textbf{Basic DataType Quick Reference}\\
       
     5 \end{center}
       
     6 Declaring an Integer:\\
       
     7 {\ex \lstinline|  b=9999999999999999999 |}
       
     8 
       
     9 Declaring a float:\\
       
    10 {\ex \lstinline|  p=3.141592 |}
       
    11 
       
    12 Declaring a Complex number:\\
       
    13 {\ex \lstinline|   c = 3.2+4.6j |}
       
    14 
       
    15 Modulo Operator:\\
       
    16 {\ex \lstinline|   87 % 6 |}
       
    17 
       
    18 Exponent Operator:\\
       
    19 {\ex \lstinline|   7**8 |}
       
    20 
       
    21 Declaring a list:\\
       
    22 {\ex \lstinline|  var_list = [1, 1.2, [1,2]] |}
       
    23 
       
    24 Declaring a string:\\
       
    25 {\ex \lstinline| k='Single quote' |}
       
    26 {\ex \lstinline| l="Double quote contain's single quote" |}
       
    27 {\ex \lstinline| m='''"Contain's both"''' |}
       
    28 
       
    29 Declaring a tuple:\\
       
    30 {\ex \lstinline|  var_tup = (1,2,3,4) |}
       
    31 
       
    32 
       
    33 Accessing Lists, string and tuples:\\
       
    34 {\ex \lstinline| seq[-1] |} 
       
    35 
       
    36 Interconversion of number datatype:\\
       
    37 {\ex \lstinline| float(2.3+4.2j) |}
       
    38 
       
    39 
       
    40 Interconversion of sequences:\\
       
    41 {\ex \lstinline| tup=tuple([1,2,3,4,5]) |}
       
    42 
       
    43 Spliting string into lists:\\
       
    44 {\ex \lstinline| ''split this sting''.split() |}
       
    45 
       
    46 Join lists to create strings:\\
       
    47 {\ex \lstinline| ','.join['List','joined','on','commas'] |}
       
    48 
       
    49 \end{Document}