You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ananyeah edited this page Mar 1, 2018
·
2 revisions
Programming Fundamentals
Data Types and Data Collections
Primitive Data Types (Basic)
- Int
- Floats
- Strings
- Bool
- None (nul)
- Nan (not a number)
Collections (An efficient way to work with a group of primitive data types or key-value-pairs)
- Data frame
- dictionaries
- vectors
- lists
- json / xml
Functions (Reusable code)
functions
my_f <- function (){
#stuff
}
Operators
+,-,/,*,%,**,&, | is !
Loops
There are times when we want to use loops like for, while-do
It's always better to work with collections and collection functions when possible and avoid loops, because collection functions internally use loops but are more efficiently written.
break and continue can be used in loops to make exception cases within loops.
If-else
python {elif}
R {}
if something is this
do that
else if (s.else is this)
do that
Libraries (Classes)
library (repr)
import numpy as np
Two kinds of classes : Inbuilt and public
Class : A group of related functions
Objects
vv
Instances of classes
class example : class chair
obj example