-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da433b5
commit 322f363
Showing
51 changed files
with
4,058 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from sympy import * | ||
exit = 0 | ||
while exit == 0: | ||
problem = input("Give a fraction or X to exit: ") | ||
if problem == "x": exit = 1 | ||
else: | ||
answer = N(parse_expr(problem)) | ||
print("%s = %.4f" % (problem, answer)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
input_string = input("Enter a string: ").lower() | ||
letters = {} | ||
for character in input_string: | ||
if character in letters: | ||
letters[character] += 1 | ||
else: | ||
letters[character] = 1 | ||
|
||
most_frequent_letter = '' | ||
highest_frequency = 0 | ||
for letter, frequency in letters.items(): | ||
if frequency > highest_frequency: | ||
most_frequent_letter = letter | ||
highest_frequency = frequency | ||
|
||
if highest_frequency > 1: | ||
print("The most repeated character was: %s, and it was repeated %d times." % (most_frequent_letter, highest_frequency)) | ||
else: | ||
print("No characters were repeated more than once") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
def f(x): | ||
# y = 5x + 3 | ||
return 5*x + 3 | ||
|
||
def g(x): | ||
# y = (x - 3) / 5 | ||
return (x-3)/5 | ||
|
||
|
||
number = float(input("Choose a number: ")) | ||
|
||
gOfFOfX = g(f(number)) | ||
fOfGOfX = f(g(number)) | ||
FOfX = f(number) | ||
GOfX = g(number) | ||
|
||
print() | ||
print("f(g("+str(number)+")) is equal to: "+str(gOfFOfX)) | ||
print() | ||
print("g(f("+str(number)+")) is equal to: "+str(fOfGOfX)) | ||
print() | ||
print("f("+str(number)+") is equal to: "+str(FOfX)) | ||
print() | ||
print("g("+str(number)+") is equal to: "+str(GOfX)) | ||
|
||
# Replace the function name with "y": y = 3x + 4 | ||
# Swap x and y: x = 5y + 3 | ||
# Solve for y: y = (x - 3) / 5 | ||
# Replace y with the inverse function notation: f^(-1)(x) = (x - 4) / 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
integerOne = int(input("Integer One? ")) | ||
integerTwo = int(input("Integer Two? ")) | ||
decimalOne = float(input("Number with decimal? ")) | ||
print("Product of int one and int two: "+str(integerOne*integerTwo)) | ||
print("Product of all 3 numbers is "+str(integerOne*integerTwo*decimalOne)) | ||
print("%s mod 2 is %s" % (integerOne, integerOne%2)) | ||
print("%s mod 2 is %s" % (integerTwo, integerTwo%2)) | ||
print("%s mod 2 is %.1f" % (decimalOne, float(decimalOne%2))) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
birthdayYear = input("What year was your bday?: ") | ||
name = input("What is your name?: ") | ||
age = input("What is your age?: ") | ||
print("Your name is %s and you are %s years old\nYou were born in %s" % (name, age, birthdayYear)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import tensorflow as tf | ||
|
||
# Define the model | ||
model = tf.keras.Sequential([ | ||
tf.keras.layers.Dense(8, input_shape=(4,), activation='relu'), | ||
tf.keras.layers.Dense(1, activation='sigmoid') | ||
]) | ||
|
||
# Compile the model | ||
model.compile(optimizer='adam', | ||
loss='binary_crossentropy', | ||
metrics=['accuracy']) | ||
|
||
# Train the model | ||
data = [[0.5, 0.5, 0.5, 0.5], [0.1, 0.2, 0.3, 0.4], [0.9, 0.8, 0.7, 0.6]] | ||
labels = [[0], [1], [0]] | ||
model.fit(data, labels, epochs=10) | ||
|
||
# Use the trained model to make predictions | ||
predictions = model.predict([[0.5, 0.5, 0.5, 0.5]]) | ||
print(predictions) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#Area & Perimeter | ||
shapeChoice = "" | ||
|
||
def run(): | ||
global shapeChoice | ||
print("Pick a shape") | ||
print("(1)Rectangle") | ||
print("(2)Square") | ||
print("(3)Parrallelogram") | ||
print("(4)Triangle") | ||
print("(5)Rhombi") | ||
print("(6)Trapezoid") | ||
print() | ||
shapeChoice = int(input("Choice: ")) | ||
|
||
run() | ||
if(shapeChoice == 1): | ||
pass | ||
elif(shapeChoice == 2): | ||
pass | ||
elif(shapeChoice == 3): | ||
pass | ||
elif(shapeChoice == 4): | ||
pass | ||
elif(shapeChoice == 5): | ||
pass | ||
elif(shapeChoice == 6): | ||
pass | ||
else: | ||
print("Incorrect choice of: "+str(shapeChoice)) | ||
print("Please try again") | ||
run() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
from tkinter import mess | ||
import tkinter as tk | ||
|
||
# Define the update function | ||
def update_python(): | ||
os.system('sudo apt-get update') | ||
os.system('sudo apt-get install python3') | ||
tk.messagebox.showinfo('Update', 'Python has been updated successfully!') | ||
|
||
# Create the GUI | ||
root = tk.Tk() | ||
root.title('Python Updater') | ||
|
||
# Add a label | ||
label = tk.Label(root, text='Click the button to update Python') | ||
label.pack(pady=10) | ||
|
||
# Add a button to update Python | ||
button = tk.Button(root, text='Update Python', command=update_python) | ||
button.pack() | ||
|
||
# Start the main event loop | ||
root.mainloop() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import tkinter as tk | ||
from tkinter import filedialog | ||
from shutil import copy2 | ||
import os | ||
|
||
class FileCopyApp: | ||
def __init__(self, root): | ||
self.root = root | ||
self.source_dir = tk.StringVar() | ||
self.destination_dir = tk.StringVar() | ||
self.setup_gui() | ||
|
||
def setup_gui(self): | ||
self.root.title("File Copy App") | ||
self.root.configure(bg='#BBDEFB') | ||
|
||
tk.Label(self.root, text="Source Directory", bg='#BBDEFB').grid(row=0, column=0) | ||
tk.Label(self.root, text="Destination Directory", bg='#BBDEFB').grid(row=1, column=0) | ||
|
||
tk.Entry(self.root, textvariable=self.source_dir).grid(row=0, column=1) | ||
tk.Entry(self.root, textvariable=self.destination_dir).grid(row=1, column=1) | ||
|
||
tk.Button(self.root, text="Browse...", command=self.browse_source, bg='#90CAF9', fg='white').grid(row=0, column=2) | ||
tk.Button(self.root, text="Browse...", command=self.browse_destination, bg='#90CAF9', fg='white').grid(row=1, column=2) | ||
|
||
tk.Button(self.root, text="Copy Files", command=self.copy_files, bg='#90CAF9', fg='white').grid(row=2, column=1) | ||
|
||
def browse_source(self): | ||
self.source_dir.set(filedialog.askdirectory()) | ||
|
||
def browse_destination(self): | ||
self.destination_dir.set(filedialog.askdirectory()) | ||
|
||
def copy_files(self): | ||
source_dir = self.source_dir.get() | ||
destination_dir = self.destination_dir.get() | ||
|
||
for filename in os.listdir(source_dir): | ||
source_file = os.path.join(source_dir, filename) | ||
if os.path.isfile(source_file): | ||
copy2(source_file, destination_dir) | ||
|
||
print("Files copied successfully!") | ||
|
||
root = tk.Tk() | ||
app = FileCopyApp(root) | ||
root.mainloop() |
Oops, something went wrong.