Skip to main content

Posts

Showing posts from September, 2022

Python Learning OOPs Part -2

  class Dog : # Class Object Attribute species = 'mammal' def __init__ ( self , breed , name ): self . breed = breed self . name = name     Lets break down what we have above.The special method __init__() is called automatically right after the object has been created, similer to construct() in php self argument is necessary in python, php has default so no need to pass in php sam = Dog ( 'Lab' , 'Sam' ) //here creating the instance of the class, no need to pass new keyword in python   Inheritance: class Animal : def __init__ ( self ): print ( "Animal created" ) def whoAmI ( self ): print ( "Animal" ) class Dog ( Animal ): // Inherating the Animal Class def __init__ ( self ): Animal . __init__ ( self ) print ( "Dog created" )   Error Handling & Exception :     try : f = open ( 'testfile' , 'r...

ES6 JS Refresher React Learning

 JavaScript refresher let and const: in Normal js we mostly used the var keyword to store the variables. but let is the new advanced concept to hold the value , its introduced in es6. let name = 'raj';  is same as var name = 'raj'; const host = 'localhost'; // To declare the constant variables   Arrow Function: let hello = () => {   return "Hello World!"; }  hello();  Exports and Imports:                            Spread & Rest Operators: const numbersOne = [1, 2, 3]; const numbersTwo = [4, 5, 6]; const numbersCombined = [...numbersOne, ...numbersTwo];      Rest Operator :  The rest operator is used to put the rest of some specific user-supplied values into a JavaScript array. function sumUp(...num){ console.log(num);//[10,20,30] here i am getting the array }   sumUp(10,20,30);// Passing here as a numbers not array Conver list of values to ...