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 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 | |
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
| 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) |
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
| # 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 |
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
| const nameInverter = function(name) { | |
| if (name === undefined) { | |
| return "Error"; | |
| } | |
| const arr = name.split(' '); | |
| const honorifics = ['Mr.', 'Mrs.', 'Ms.', 'Dr.']; | |
| let start = 0; |
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
| // 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); | |
| } | |
| }); | |
| } |