Skip to content

Instantly share code, notes, and snippets.

View wakoliVotes's full-sized avatar
"FreeSpirit"

Votes Wakoli wakoliVotes

"FreeSpirit"
View GitHub Profile
@wakoliVotes
wakoliVotes / Adding and Multiplying Matrices Using Python
Created May 25, 2021 13:50
Using Python to Add and Multiply 2 by 2 Matrices. In this Tutorial, the aim is demonstrating addition and multiplication of matrices
# Matrices forms an important Mathematical concepts, with wider adoption
# In this Tutorial, the aim is demonstrating addition and multiplication of matrices
# The below matrices, M1 and M2 are used for initial illustrations
M1 = [[8,14,-6],
[12,7,4],
[-11,3,21]]
M2 = [[3, 16, -6],
[9, 7, -4],
[-1, 3, 13]]
# To print the matrix, we thus do the following operation
@wakoliVotes
wakoliVotes / Python-to-Calculate-Team-Points.py
Last active February 19, 2022 00:11
Python is Used in this case to Calculate a Team's based on Wins, Draws and Losses. This functions works by taking wins, draws and losses and computing a teams total points
# This functions works by taking wins, draws and losses and computing a teams total points
# In this scenario, a win = 3 points, a draw = 1 point and a loss = 0 points
onesTeamName = input("Enter the Name of your name : ")
wonMatches = input("Kindly enter the number of matches your team won : ")
if float(wonMatches) >= 40:
print("Error, please enter a valid number")
drawMatches = input("Kindly enter the number of matches your team draw : ")
if float(drawMatches) >= 40:
print("Error, please enter a valid number")
lossMatches = input("Kindly enter the number of matches your team lost : ")
@wakoliVotes
wakoliVotes / CSS File
Created May 28, 2021 21:26
Simple Home Page with HTML and CSS
*
{
margin-left: 4px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.homecopy a
{
text-decoration: none;
}
.contents
#In this basic variable assignment, A student learning Python was trying to make a function.
# His code should concatenate a passed string name with string "Edabit" and store it in a variable called result.
# He needs your help to fix this code
name_string = input("Enter the Passed String: ")
print("|==============================|")
print("You Entered: " , name_string)
result = name_string+("Edabit")
print("Your Result is: " + result)
@wakoliVotes
wakoliVotes / FibonacciSequence.py
Last active February 14, 2022 06:06
Python Function to Display Fibonacci Sequence given specific number of item counts
# Function to create Fibonacci Sequence given that the user defines number of values
# First, use the "def" keyword to define the function
def fibonacciSequence():
# Next, asking users to state the proportion or number of sequence terms to generate
numberOfTerms = int(input("Hi, enter number of terms to for the Sequence: "))
# Defining the first two terms that are mandatory
@wakoliVotes
wakoliVotes / DalvikARTComparison.csv
Last active February 19, 2022 00:35
Android Runtimes
Dalvik Virtual Machine Android Run Time(ART)
Faster Booting time Rebooting is significantly longer
Cache builds up overtime The cache is built during the first boot
Uses Just-In-Time(JIT) compiler Uses Ahead-Of-Time(AOT) compiler
Occupies less space due to JIT Consumes a lot of storage space internally due to AOT
Works best for small storage devices Works best for Large storage devices
Longer app loading time Extremely Faster and smoother load time and lower processor use
Apps lagging due to garbage collector pauses and JIT Reduced apps lagging and better user experience
Lower installation time as compilation is done later Longer as compilation is done at installation
DVM converts bytecode every time app is launched ART converts just once at app installation.
# Create the Class
class founderInfo:
def __init__(self, firstName, secondName, age, annualSalary, status):
self.firstName = firstName
self.secondName = secondName
self.age = age
self.annualSalary = annualSalary
self.status = status
# Implementation of the FIFO Property using Python Queues
# Class definition
class QueueData:
# An empty queue that will store the elements
def __init__(self):
self.data = []
# enqueue() method
# Adding the first element e to the queue
def enqueue(self, e):
import networkx as nx
import matplotlib.pyplot as plt
# Created empty Graph G
G = nx.Graph()
# Adding Edges to "G" using add_edge
G.add_edge(1, 2, weight = 12.5)
G.add_edge(3, 2, weight = 50.0)
G.add_edge(1, 3, weight = 17)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">
// Use parseInt to convert the entered string to integer
var x = parseInt(prompt("Enter First Number: "));