This file contains 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
# Reading a CSV and creating a chart | |
import pandas as pd | |
import matplotlib.pyplot as plt # Provides us functions to create the visuals | |
# EOD Pricing for 12 instruments | |
data = pd.read_csv('/content/tr_eikon_eod_data.csv', #File location | |
index_col=0, # First column treated as an index | |
parse_dates=True) # Indicies are Dates | |
plt.plot(data['AAPL.O']) |
This file contains 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 os | |
from google.cloud import texttospeech | |
from google.oauth2 import service_account | |
credentials = service_account.Credentials.from_service_account_file('ga-service-key.json') | |
def synthesize_text(text): | |
"""Synthesizes speech from the input string of text.""" | |
This file contains 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 guizero import App, PushButton | |
app = App("File Picker") | |
def pick(): | |
app.select_file() | |
button = PushButton(app, text="Get File", command=pick) | |
This file contains 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
# Imports --------------- | |
from guizero import App, Box, PushButton, Text | |
# Functions ------------- | |
def clear_board(): | |
new_board = [ [None, None, None], | |
[None, None, None], | |
[None, None, None] ] | |
for numberX in range(3): |
This file contains 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 check_win(): | |
winner = None | |
# Vertical lines | |
if (board_squares[0][0].text == board_squares[0][1].text == board_squares[0][2].text) and board_squares[0][2].text in ["X", "O"]: | |
winner = board_squares[0][0] | |
# Horizontal lines | |
elif (board_squares[0][0].text == board_squares[1][0].text == board_squares[2][0].text) and board_squares[2][0].text in ["X", "O"]: | |
winner = board_squares[0][0] | |
# Diagonals | |
elif (board_squares[0][0].text == board_squares[1][1].text == |
This file contains 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
public class FindPairs { | |
public static int countPairs(int[] a) { | |
Integer[] pairsFound = new Integer[a.length]; | |
// Get the ith item in the list | |
for (int i = 0; i < a.length; i++) { |
This file contains 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
public void function(int N) { | |
Stack<Integer> stack = new Stack<Integer>(); | |
while (N > 0) { | |
stack.push(N % 2); | |
N = N / 2; | |
} | |
for (int b: stack) {StdOut.print(b);} |
This file contains 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
/****************************************************************************** | |
* Compilation: javac LinkedStackOfStrings.java | |
* Execution: java LinkedStackOfStrings | |
* Data files: https://introcs.cs.princeton.edu/java/43stack/tobe.txt | |
* | |
* A stack of strings, implemented using a linked list. | |
* | |
* % more tobe.txt | |
* to be or not to - be - - that - - - is | |
* |
This file contains 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
/****************************************************************************** | |
* Compilation: javac FixedCapacityStackOfStrings.java | |
* Execution: java FixedCapacityStackOfStrings | |
* Dependencies: StdIn.java StdOut.java | |
* | |
* Stack of strings implementation with a fixed-size array. | |
* | |
* % more tobe.txt | |
* to be or not to - be - - that - - - is | |
* |
This file contains 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 edu.princeton.cs.algs4.In; | |
import edu.princeton.cs.algs4.Quick; | |
public class Filtering34 { | |
public static void minMaxFilter() { | |
In in = new In(); | |
int max = in.readInt(); | |
int min = max; |
NewerOlder