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
| class Andela: | |
| fellows = 'top .5 percent in Nigeria' | |
| fellow_list = [1,2,3,4,5] | |
| @staticmethod | |
| def say_the_chant(): | |
| print "Andela Aww Yea!!!!" | |
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
| class Singleton: | |
| the_actual_instance = None | |
| class _Singleton: | |
| """ | |
| The actual implementation of the Singleton class should reside here | |
| """ | |
| def __init__(self): | |
| self.required_attribute = 'mayor' | |
| print('this should only be printed once.. i.e this class should only be instantiated once.') |
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
| def factorial(num): | |
| if num == 0: | |
| return 1 | |
| else: | |
| return num * factorial(num - 1) |
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
| def power(a,b): | |
| if b == 0: | |
| return 1 | |
| elif a == 0: | |
| return 0 | |
| else: | |
| return a * power(a,b-1) |
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
| function factorial( n ) { | |
| if ( n === 1 ) { | |
| return 1; | |
| } | |
| return n * factorial( n - 1 ); | |
| } |
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
| function power(a,b){ | |
| if (b === 0){ | |
| return 1 | |
| } | |
| else if (a === 0){ | |
| return 0 | |
| } | |
| else{ | |
| return a * power(a,b-1) | |
| } |
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
| class Human { | |
| constructor(name, id){ | |
| this.name = name; | |
| this.id = id; | |
| } | |
| } | |
| one = new Human('bolaji',1); | |
| two = new Human('murphy', 1); | |
| three = new Human('anu',3); |
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
| // class | |
| var Person = function(name, gender) { | |
| this.name = name; | |
| this.gender = gender; | |
| this.legs = 2; | |
| } | |
| Person.prototype.getName = function () { | |
| return this.name; | |
| } |
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
| sample_array = ['Bolaji','Damilola','Ichiato','Oladipupo','Koya','Mumeen'] | |
| # I want to cycle through the array an check if an element is there. | |
| # Here i want to see if 'Bolaji' is in the sample_array | |
| def name_exists(name): | |
| for element in sample_array: | |
| if element == name: | |
| print("Bolaji Exists") |
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
| import React from "react"; | |
| import PropTypes from "prop-types"; | |
| import {connect} from "react-redux"; | |
| import * as courseActions from "../../actions/courseAction"; | |
| class CoursesPage extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { |
OlderNewer