summaryrefslogtreecommitdiff
path: root/basic-data-type/quickref.tex
blob: 1047219f2a25e458cb8f8002d4fccb996f31e56e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
\documentclass{article}
\begin{Document}
\begin{center}
\textbf{Basic DataType Quick Reference}\\
\end{center}
Declaring an Integer:\\
{\ex \lstinline|  b=9999999999999999999 |}

Declaring a float:\\
{\ex \lstinline|  p=3.141592 |}

Declaring a Complex number:\\
{\ex \lstinline|   c = 3.2+4.6j |}

Modulo Operator:\\
{\ex \lstinline|   87 % 6 |}

Exponent Operator:\\
{\ex \lstinline|   7**8 |}

Declaring a list:\\
{\ex \lstinline|  var_list = [1, 1.2, [1,2]] |}

Declaring a string:\\
{\ex \lstinline| k='Single quote' |}
{\ex \lstinline| l="Double quote contain's single quote" |}
{\ex \lstinline| m='''"Contain's both"''' |}

Declaring a tuple:\\
{\ex \lstinline|  var_tup = (1,2,3,4) |}


Accessing Lists, string and tuples:\\
{\ex \lstinline| seq[-1] |} 

Interconversion of number datatype:\\
{\ex \lstinline| float(2.3+4.2j) |}


Interconversion of sequences:\\
{\ex \lstinline| tup=tuple([1,2,3,4,5]) |}

Spliting string into lists:\\
{\ex \lstinline| ''split this sting''.split() |}

Join lists to create strings:\\
{\ex \lstinline| ','.join['List','joined','on','commas'] |}

\end{Document}