Skip to content

Instantly share code, notes, and snippets.

View HarunMbaabu's full-sized avatar
🎯
Focusing

Harun Mbaabu HarunMbaabu

🎯
Focusing
View GitHub Profile
import numpy as np
import cv2
# load image in color
img = cv2.imread(“cat.jpg”)
#load image in grey
gimg = cv2.imread(“cat.jpg”,0)
#Displaying images
cv2.imshow(“cat image”, img)
cv2.imshow(“gray image”, gimg)
import numpy as np
import cv2
# loads the image in color
img = cv2.imread(“cat.jpg”)
# loads the image in grayscale 
gray_img = cv2.imread(“image.jpg”, cv2.IMREAD_GRAYSCALE)
import cv2

#Reading images in color and grayscale
color_img = cv2.imread('cat.jpeg')
gray_img = cv2.imread('cat.jpeg',0)

#Displaying the image
cv2.imshow('Cat image', color_img)
import pandas as pd
# import library to split the data
from sklearn.model_selection import train_test_split
%matplotlib inline
import matplotlib.pyplot as plt
def read_data():
"""

This is a basic introduction where we learn how to output Hello World! and see the differences between Python and C++.

Main difference in running C++ and Python.

If you are familiar with python, you know we can easily create a file called hello.py and simply run it with python hello.py, However for C++, we’ve 1 more step, the compiling step.

First you Create the file hello.cpp , then you compile it g++ hello.cpp -o hello and finally run it ./hello

“Hello World” program

/* Create an Array */
const marks = new Array(78,90,74,39,80);
/* or */
const marks = [78,90,74,39,80];
/* Join Method */
const array = ["m","o","n","d","a","y"];
console.log(array.join(""));
//output: monday

React File Structure

react-todo-app
    ├── node_modules
    ├── public
    │    ├── favicon.ico
    │    ├── index.html
    │    ├── logo192.png
    │    ├── logo512.png
 │ ├── manifest.json

Styling Reactjs App

There are several ways we can style our ReactElements and Compoents but we will only cover the inline CSS, the CSS stylesheet and the CSS Modules.

Some of the other strategies include – CSS-in-JS (e.g styled components, Emotion, JSS), Sass & SCSS, Less, Utility-First-CSS (e.g Tailwind CSS).

CSS Stylesheet

This is quite basic and straight forward method as you should be familiar with it while working with HTML file.

You start by creating a new file called App.css in the src folder.

Writing React Directly in HTML

This method of interacting with React is the simplest way and it’s very easy if you have ever worked with HTML, CSS and JavaScript.

  • You’ll need an HTML file where you load three scripts in the head element pointing to their respective CDN – the React, ReactDOM and Babel.

  • Then, you’ll create an empty div element and give it an id of root. This is where your application will live.

  • Lastly, you’ll create a script element where you write your React code.

This is how your index.html file should look like:

pangram

A pangram is a unique sentence in which every letter of the alphabet is used at least once. The name comes from the Greek root words pan, meaning “all,” and gram, meaning “something written or recorded”.

Problem Description

The program takes a string and checks if it is a pangram or not.

Algorithm

  1. Take a string from the user and store it in a variable.
  2. Pass the string as an argument to a function.
  3. In the function, form two sets- one of all lower case letters and one of the letters in the string.