Skip to content

Instantly share code, notes, and snippets.

View EbrahimGhanbari's full-sized avatar
🏠
Working from home

Ebrahim Ghanbari EbrahimGhanbari

🏠
Working from home
View GitHub Profile
@EbrahimGhanbari
EbrahimGhanbari / account.py
Created September 9, 2020 08:11
Python_OOP_Bank_Account
class Account:
def __init__(self, filePath):
self.filePath = filePath
with open(filePath, 'r') as file:
self.balance = int(file.read())
def withdraw(self, amount):
self.balance=self.balance - amount
@EbrahimGhanbari
EbrahimGhanbari / kmToMilesApp.py
Created September 6, 2020 19:09
udemy_python_tkinter_kmToMile_App
from tkinter import *
window=Tk()
def kmToMiles():
miles = float(e1_value.get())*(1/1.6)
t1.insert(END, miles)
b1=Button(window, text="Execute", command=kmToMiles)
b1.grid(row=0, column=0)
# Terminal Cheat Sheet
pwd # print working directory
ls # list files in directory
cd # change directory
~ # home directory
.. # up one directory
- # previous working directory
help # get help
-h # get help
@EbrahimGhanbari
EbrahimGhanbari / nameInverter.js
Created June 6, 2020 09:00
LHL W1 WE Name Formatter
const nameInverter = function(name) {
if (name === undefined) {
return "Error";
}
const arr = name.split(' ');
const honorifics = ['Mr.', 'Mrs.', 'Ms.', 'Dr.'];
let start = 0;
@EbrahimGhanbari
EbrahimGhanbari / findWaldoAnonymously.js
Created May 28, 2020 19:49
LHL W1 D4 Functions As Objects Practice - Revision
// The second argument/parameter is expected to be a (callback) function
const findWaldo = function(names, found) {
names.forEach(function (name, index) {
if (name === "Waldo") {
found(index);
}
});
}