Created
December 4, 2019 07:08
-
-
Save SaravananRajaraman/ac676078490eed59f56f85228489e65b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "# Python Fundamentals " | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 15, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "<class 'complex'>\n", | |
| " \n", | |
| "No 9, 2nd floor A, Saragabani St, \n", | |
| "Sholinganallur,\n", | |
| "Chennai 600119.\n", | |
| "\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "# Data types :D \n", | |
| "\n", | |
| "name = 'Saravanan' #str\n", | |
| "des = \"Developmemt Lead\" #str\n", | |
| "#Mulit line Str\n", | |
| "address = ''' \n", | |
| "No 9, 2nd floor A, Saragabani St, \n", | |
| "Sholinganallur,\n", | |
| "Chennai 600119.\n", | |
| "'''\n", | |
| "\n", | |
| "bankId = 1540326 #int\n", | |
| "height = 6.0 #float\n", | |
| "someComplex = 1+5j #complex\n", | |
| "\n", | |
| "# Print stuff\n", | |
| "print(type(someComplex))\n", | |
| "print(address)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 31, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "S\n", | |
| "Standard Chartered GBS\n", | |
| "SBG deretrahC dradnatS\n", | |
| "Standard\n", | |
| "dradnatS\n", | |
| "STANDARD CHARTERED GBS\n", | |
| "standard chartered gbs\n", | |
| "22\n", | |
| "['Standard', 'Chartered', 'GBS']\n" | |
| ] | |
| }, | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "'Chartered'" | |
| ] | |
| }, | |
| "execution_count": 31, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "#Data Scince \n", | |
| "#String method and indexing\n", | |
| "\n", | |
| "#Indexing\n", | |
| "#NOTE: Consider the string has index from 0 and also has the negitive index will start with -1 from the last char\n", | |
| "c = 'Standard Chartered GBS';\n", | |
| "\n", | |
| "print(c[0])\n", | |
| "print(c[::])\n", | |
| "print(c[::-1])\n", | |
| "print(c[0:8])\n", | |
| "\n", | |
| "\n", | |
| "c1 = c[0:8];\n", | |
| "print(c1[::-1])\n", | |
| "\n", | |
| "print(c.upper())\n", | |
| "print(c.lower())\n", | |
| "print(len(c))\n", | |
| "print(c.split(' '))\n", | |
| "\n", | |
| "cSplit = c.split(' ')\n", | |
| "\n", | |
| "cSplit[1]" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 8, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "-- Arithmetic --\n", | |
| "9549\n", | |
| "8299\n", | |
| "99588\n", | |
| "10287.75\n", | |
| "10287\n", | |
| "-- Logical --\n", | |
| "False\n", | |
| "True\n", | |
| "True\n", | |
| "\n", | |
| "-- Relation --\n", | |
| "\n", | |
| "\n", | |
| "\n", | |
| "-- Bitwise --\n", | |
| "\n", | |
| "\n", | |
| "-- Identity --\n", | |
| "\n", | |
| "False\n", | |
| "True\n", | |
| "True\n", | |
| "False\n", | |
| "True\n", | |
| "\n", | |
| "-- MemberShip --\n", | |
| "\n", | |
| "False\n", | |
| "True\n", | |
| "True\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "# Arithmetic and Logical Operators\n", | |
| "\n", | |
| "# Arithmetic\n", | |
| "print('-- Arithmetic --')\n", | |
| "\n", | |
| "#Eg : Salary\n", | |
| "basic = 4000\n", | |
| "allo = 2000\n", | |
| "conv = 3549\n", | |
| "\n", | |
| "sal = basic + allo + conv\n", | |
| "print(sal)\n", | |
| "\n", | |
| "#detection\n", | |
| "pf = 1250\n", | |
| "sal -= pf\n", | |
| "\n", | |
| "print(sal)\n", | |
| "\n", | |
| "takeHomeCTC = sal * 12\n", | |
| "\n", | |
| "print(takeHomeCTC)\n", | |
| "\n", | |
| "bon = 123453\n", | |
| "print(bon/12) # div\n", | |
| "print(bon//12) # floor-div\n", | |
| "\n", | |
| "\n", | |
| "# Logical \n", | |
| "print('-- Logical --')\n", | |
| "\n", | |
| "yes = True\n", | |
| "no = False \n", | |
| "\n", | |
| "print(yes and no)\n", | |
| "print(yes or no)\n", | |
| "print(not no)\n", | |
| "\n", | |
| "# Relation \n", | |
| "print('''\n", | |
| "-- Relation --\n", | |
| "''')\n", | |
| "print()\n", | |
| "\n", | |
| "\n", | |
| "# Bitwise \n", | |
| "print('''\n", | |
| "-- Bitwise --\n", | |
| "''')\n", | |
| "\n", | |
| "\n", | |
| "# Identity \n", | |
| "print('''\n", | |
| "-- Identity --\n", | |
| "''')\n", | |
| "\n", | |
| "a = [1, 2, 3, 4, 5]\n", | |
| "b = [1, 2, 3, 4, 5]\n", | |
| "c = a\n", | |
| "print(a is b)\n", | |
| "print(a is c)\n", | |
| "print(a is not b)\n", | |
| "print(a is not c)\n", | |
| "print(a == b)\n", | |
| "\n", | |
| "\n", | |
| "# MemberShip \n", | |
| "print('''\n", | |
| "-- MemberShip --\n", | |
| "''')\n", | |
| "\n", | |
| "print(10 in a)\n", | |
| "print(10 not in a)\n", | |
| "print(3 in a)" | |
| ] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python 3", | |
| "language": "python", | |
| "name": "python3" | |
| }, | |
| "language_info": { | |
| "codemirror_mode": { | |
| "name": "ipython", | |
| "version": 3 | |
| }, | |
| "file_extension": ".py", | |
| "mimetype": "text/x-python", | |
| "name": "python", | |
| "nbconvert_exporter": "python", | |
| "pygments_lexer": "ipython3", | |
| "version": "3.7.3" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 4 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment