Skip to content

Instantly share code, notes, and snippets.

View niranjrajasekaran's full-sized avatar

Niranj Rajasekaran niranjrajasekaran

View GitHub Profile
@niranjrajasekaran
niranjrajasekaran / niranj.vim
Created August 3, 2020 11:15
A simple vimrc config file for python projects
set nocompatible " required
filetype off " required
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
" Line Number
set number
In [1]: l = [10, 'python-list', 1, 2, 3, 4, 5, [1, 2, 3, 4, 5]]
In [2]: l
Out[2]: [10, 'python-list', 1, 2, 3, 4, 5, [1, 2, 3, 4, 5]]
In [3]: l[0]
Out[3]: 10
In [4]: l[1]
Out[4]: 'python-list'
@niranjrajasekaran
niranjrajasekaran / list-write.py
Last active May 27, 2019 11:02
Method to write data to python list
In [1]: l = list()
In [2]: type(l)
Out[2]: list
In [3]: l
Out[3]: []
In [4]: l.append(10)
@niranjrajasekaran
niranjrajasekaran / tuple.py
Last active May 11, 2019 16:15
Basic implementation of python tuples
In [1]: t = (1, 2, 3, 4)
In [2]: t[0]
Out[2]: 1
In [3]: t[0] = 10
TypeError Traceback (most recent call last)
<ipython-input-4-88963aa635fa> in <module>()
1 t[0] = 10
@niranjrajasekaran
niranjrajasekaran / set.py
Last active May 11, 2019 15:27
Basic implementation of python set
In [1]: s = {1, 2, 3, 4}
In [2]: type(s)
Out[2]: set
In [3]: s = {1, 10, 1, 3, 4}
In [4]: s
Out[4]: {1, 3, 4, 10}
@niranjrajasekaran
niranjrajasekaran / dict.py
Last active May 8, 2019 08:59
Basic Implementation of python dict
In [1]: d = {'first_value': 1, 'second_value': 2}
In [2]: type(d)
Out[2]: dict
In [3]: d['fist_value']
Out[3]: 1
@niranjrajasekaran
niranjrajasekaran / list.py
Last active May 8, 2019 08:52
Introduction to python lists
In [1]: l = [1, 2, 3, 4, 5]
In [2]: type(l)
Out[2]: list
In [3]: l[0]
Out[3]: 1
@niranjrajasekaran
niranjrajasekaran / statically_typed.c
Created May 5, 2019 05:17
Showcasing statically typed language
#include<stdio.h>
int main()
{
const char a[] = "this is a string";
printf("%s\n", a);
a = 10;
return 0;
}
@niranjrajasekaran
niranjrajasekaran / dynamically_typed.py
Created May 5, 2019 05:08
Showcasing dynamically typed language
In [2]: a = 'This is a string'
In [3]: print(a)
This is a string
In [4]: a = 10
In [5]: print(a)
10