content stringlengths 65 38.5k | folder stringclasses 16
values | source stringclasses 4
values | timestamp float64 1.79B 1.79B |
|---|---|---|---|
Instruction: Help me set up my daily to-do list!
Code: ```python
tasks = []
while True:
task = input('Enter a task or type 'done' to finish: ')
if task == 'done': break
tasks.append(task)
print(f'Your to-do list for today: {tasks}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.764114 |
Instruction: Create a shopping list based on my inputs!
Code: ```python
shopping_list = {}
while True:
item = input('Enter an item or type 'done' to finish: ')
if item == 'done': break
quantity = input(f'Enter the quantity for {item}: ')
shopping_list[item] = quantity
print(f'Your shopping list: {shoppi... | Python_Core | flytech_python_vault | 1,789,452,018.76433 |
Instruction: Calculate how much time I spend on my phone per week!
Code: ```python
total_time = 0
for i in range(1, 8):
time = float(input(f'Enter phone usage in hours for day {i}: '))
total_time += time
print(f'You spend approximately {total_time} hours per week on your phone.')
``` | Python_Core | flytech_python_vault | 1,789,452,018.764476 |
Instruction: Help me split the bill among my friends!
Code: ```python
total_bill = float(input('Enter the total bill amount: '))
friends_count = int(input('Enter the number of friends: '))
per_person = total_bill / friends_count
print(f'Each person should pay {per_person}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.764607 |
Instruction: Organize my movie list into genres!
Code: ```python
movie_list = {}
while True:
genre = input('Enter a movie genre or type 'done' to finish: ')
if genre == 'done': break
movie = input(f'Enter a movie for the {genre} genre: ')
movie_list.setdefault(genre, []).append(movie)
print(f'Your organ... | Python_Core | flytech_python_vault | 1,789,452,018.764737 |
Instruction: Calculate the average rating of my book collection!
Code: ```python
ratings = []
while True:
rating = input('Enter a book rating or type 'done' to finish: ')
if rating == 'done': break
ratings.append(float(rating))
average_rating = sum(ratings) / len(ratings)
print(f'The average rating of your ... | Python_Core | flytech_python_vault | 1,789,452,018.764869 |
Instruction: Create a playlist based on my mood!
Code: ```python
mood = input('What's your mood today? ')
playlist = []
while True:
song = input(f'Enter a song that fits your {mood} mood or type 'done' to finish: ')
if song == 'done': break
playlist.append(song)
print(f'Your {mood} playlist: {playlist}')
``... | Python_Core | flytech_python_vault | 1,789,452,018.765065 |
Instruction: Help me find the best deals on my shopping list!
Code: ```python
best_deals = {}
while True:
item = input('Enter a shopping item or type 'done' to finish: ')
if item == 'done': break
price = float(input(f'Enter the best price you found for {item}: '))
best_deals[item] = price
print(f'The be... | Python_Core | flytech_python_vault | 1,789,452,018.765204 |
Instruction: Calculate how much I need to save per month for my vacation!
Code: ```python
vacation_cost = float(input('Enter the total cost of your vacation: '))
months_left = int(input('Enter the number of months until your vacation: '))
monthly_savings = vacation_cost / months_left
print(f'You need to save {monthly_s... | Python_Core | flytech_python_vault | 1,789,452,018.765339 |
Instruction: Determine the most efficient route for my errands!
Code: ```python
locations = []
while True:
location = input('Enter a location for your errands or type 'done' to finish: ')
if location == 'done': break
locations.append(location)
# Assuming first location is the starting point
print(f'The most... | Python_Core | flytech_python_vault | 1,789,452,018.765465 |
Instruction: Help me manage my subscriptions!
Code: ```python
subscriptions = {}
while True:
name = input('Enter the subscription name or type 'done' to finish: ')
if name == 'done': break
cost = float(input(f'Enter the monthly cost for {name}: '))
subscriptions[name] = cost
print(f'Your subscriptions: ... | Python_Core | flytech_python_vault | 1,789,452,018.765593 |
Instruction: Create a meal plan for the week!
Code: ```python
meal_plan = {}
for day in ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']:
meal = input(f'What meal would you like to have on {day}? ')
meal_plan[day] = meal
print(f'Your meal plan for the week: {meal_plan}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.765718 |
Instruction: Calculate my carbon footprint based on my daily activities!
Code: ```python
transport = input('How do you usually commute (car, bike, walk, public)? ')
food = input('Are you a vegetarian, vegan, or omnivore? ')
electricity = float(input('Approximate monthly electricity bill: '))
carbon_footprint = {'car': ... | Python_Core | flytech_python_vault | 1,789,452,018.765847 |
Instruction: Help me set reminders for my favorite TV shows!
Code: ```python
tv_reminders = {}
while True:
show = input('Enter the TV show name or type 'done' to finish: ')
if show == 'done': break
time = input(f'What time does {show} air? ')
tv_reminders[show] = time
print(f'Your TV show reminders: {tv... | Python_Core | flytech_python_vault | 1,789,452,018.765985 |
Instruction: Assist me in managing my study schedule!
Code: ```python
study_schedule = {}
subjects = input('Enter the subjects you are studying separated by commas: ').split(', ')
for subject in subjects:
hours = int(input(f'How many hours do you want to allocate to {subject}? '))
study_schedule[subject] = hour... | Python_Core | flytech_python_vault | 1,789,452,018.766111 |
Instruction: Help me calculate the ROI for my investments!
Code: ```python
initial_investment = float(input('Enter the initial investment amount: '))
final_value = float(input('Enter the final value of the investment: '))
roi = ((final_value - initial_investment) / initial_investment) * 100
print(f'Your ROI is {roi:.2f... | Python_Core | flytech_python_vault | 1,789,452,018.766231 |
Instruction: Assist me in tracking my water intake!
Code: ```python
water_intake = 0
while True:
intake = input('Enter the amount of water consumed in ml or type 'done' to finish: ')
if intake == 'done': break
water_intake += int(intake)
print(f'Your total water intake today is {water_intake} ml.')
``` | Python_Core | flytech_python_vault | 1,789,452,018.76636 |
Instruction: Help me find the best time to post on social media based on my followers!
Code: ```python
follower_timezones = input('Enter the timezones of your followers separated by commas: ').split(', ')
best_time = max(set(follower_timezones), key = follower_timezones.count)
print(f'The best time to post is when it's... | Python_Core | flytech_python_vault | 1,789,452,018.766481 |
Instruction: Assist me in calculating my monthly budget!
Code: ```python
income = float(input('Enter your monthly income: '))
expenses = float(input('Enter your total monthly expenses: '))
net_income = income - expenses
print(f'Your net income for the month is {net_income}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.766599 |
Instruction: Calculate my coffee consumption
Code: ```python
cups_per_day = int(input('How many cups of coffee do you drink daily? '))
annual_consumption = cups_per_day * 365
print(f'You consume {annual_consumption} cups of coffee per year.')
``` | Python_Core | flytech_python_vault | 1,789,452,018.766717 |
Instruction: Help me balance my diet
Code: ```python
calories = int(input('Enter your daily calorie goal: '))
protein = int(input('Enter your daily protein goal in grams: '))
print(f'To balance your diet, aim for {calories} calories and {protein}g of protein daily.')
``` | Python_Core | flytech_python_vault | 1,789,452,018.766834 |
Instruction: Help me set fitness goals
Code: ```python
current_weight = float(input('Enter your current weight in kg: '))
target_weight = float(input('Enter your target weight in kg: '))
weeks = int(input('In how many weeks do you want to achieve this? '))
weekly_goal = (current_weight - target_weight) / weeks
print(f'... | Python_Core | flytech_python_vault | 1,789,452,018.766964 |
Instruction: Sort my favorite quotes
Code: ```python
quotes = []
while True:
quote = input('Enter a favorite quote or type 'done' to finish: ')
if quote == 'done': break
quotes.append(quote)
print(f'Your sorted quotes: {sorted(quotes)}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.767089 |
Instruction: Help me manage my reading list
Code: ```python
reading_list = []
while True:
book = input('Add a book to your reading list or type 'done' to finish: ')
if book == 'done': break
reading_list.append(book)
print(f'Your reading list: {reading_list}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.76721 |
Instruction: Recommend me a movie based on my mood
Code: ```python
mood = input('What is your mood? ')
mood_to_movie = {'happy': 'La La Land', 'sad': 'The Pursuit of Happyness', 'excited': 'Fast & Furious'}
print(f'Recommended movie: {mood_to_movie.get(mood, "Sorry, I don't have a recommendation for that mood.")}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.767339 |
Instruction: Calculate how much I should tip
Code: ```python
bill = float(input('Enter the total bill amount: '))
tip_percent = int(input('Enter the tip percentage you want to leave: '))
tip_amount = (bill * tip_percent) / 100
print(f'You should leave a tip of {tip_amount:.2f}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.767457 |
Instruction: Find me the best day to book a flight
Code: ```python
days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
# Typically, flights are cheaper on Tuesdays and Wednesdays
best_days = ['Tuesday', 'Wednesday']
print(f'The best days to book a flight are usually {best_days}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.767577 |
Instruction: Calculate my screen time
Code: ```python
daily_screen_time = int(input('Enter your daily screen time in minutes: '))
weekly_screen_time = daily_screen_time * 7
print(f'Your weekly screen time is {weekly_screen_time} minutes.')
``` | Python_Core | flytech_python_vault | 1,789,452,018.767696 |
Instruction: Switch to dark mode
Code: ```python
import os
os.system('dark-mode on')
``` | Python_Core | flytech_python_vault | 1,789,452,018.767815 |
Instruction: Open a random browser tab from a list of my favorite websites
Code: ```python
import random
import webbrowser
websites = ['https://www.reddit.com', 'https://www.youtube.com', 'https://www.github.com']
webbrowser.open(random.choice(websites))
``` | Python_Core | flytech_python_vault | 1,789,452,018.767933 |
Instruction: Create a quick text note
Code: ```python
note = input('Enter your note: ')
with open('quick_note.txt', 'w') as f:
f.write(note)
``` | Python_Core | flytech_python_vault | 1,789,452,018.768072 |
Instruction: Restart my PC now!
Code: ```python
import os
import time
reboot_time = input('Please enter the time for reboot in minutes or type now for immediate reboot: ')
if reboot_time.lower() == 'now':
os.system('reboot')
else:
time.sleep(int(reboot_time) * 60)
os.system('reboot')
``` | Python_Core | flytech_python_vault | 1,789,452,018.768192 |
Instruction: Empty my recycle bin
Code: ```python
import os
os.system('EmptyRecycleBin.exe')
``` | Python_Core | flytech_python_vault | 1,789,452,018.768321 |
Instruction: Set my desktop background color to black
Code: ```python
import ctypes
c_types.windll.user32.SystemParametersInfoW(20, 0, 'C:\\path\\to\\black.jpg', 3)
``` | Python_Core | flytech_python_vault | 1,789,452,018.768441 |
Instruction: Show system information
Code: ```python
import platform
print(f'OS: {platform.system()}
Version: {platform.version()}
Architecture: {platform.architecture()[0]}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.768561 |
Instruction: Find the largest file in a given folder
Code: ```python
import os
folder = input('Enter folder path: ')
all_files = [(f, os.path.getsize(os.path.join(folder, f))) for f in os.listdir(folder) if os.path.isfile(os.path.join(folder, f))]
print(f'Largest file: {max(all_files, key=lambda x: x[1])[0]}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.768681 |
Instruction: Close all instances of a specific application
Code: ```python
import os
app = input('Enter the name of the application to close: ')
os.system(f'taskkill /F /IM {app}.exe')
``` | Python_Core | flytech_python_vault | 1,789,452,018.7688 |
Instruction: Toggle airplane mode
Code: ```python
import os
os.system('airplane-mode toggle')
``` | Python_Core | flytech_python_vault | 1,789,452,018.768916 |
Instruction: Clone a GitHub repository
Code: ```python
import os
repo_url = input('Enter the GitHub repository URL: ')
os.system(f'git clone {repo_url}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.769053 |
Instruction: Create a SQLite database and table
Code: ```python
import sqlite3
conn = sqlite3.connect('database.db')
c = conn.cursor()
c.execute('''CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)''')
conn.commit()
conn.close()
``` | Python_Core | flytech_python_vault | 1,789,452,018.769172 |
Instruction: Update all Python packages
Code: ```python
import os
os.system('pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U')
``` | Python_Core | flytech_python_vault | 1,789,452,018.769299 |
Instruction: Run a Python script at a specific time
Code: ```python
import time
import os
from datetime import datetime
run_time = input('Enter the time to run the script (HH:MM): ')
while True:
if datetime.now().strftime('%H:%M') == run_time:
os.system('python your_script.py')
break
time.sleep(... | Python_Core | flytech_python_vault | 1,789,452,018.76942 |
Instruction: Rename all files in a folder to lowercase
Code: ```python
import os
folder = input('Enter the folder path: ')
for filename in os.listdir(folder):
os.rename(os.path.join(folder, filename), os.path.join(folder, filename.lower()))
``` | Python_Core | flytech_python_vault | 1,789,452,018.769538 |
Instruction: Count the number of lines in a file
Code: ```python
filename = input('Enter the filename: ')
with open(filename, 'r') as f:
line_count = sum(1 for _ in f)
print(f'The file has {line_count} lines.')
``` | Python_Core | flytech_python_vault | 1,789,452,018.769654 |
Instruction: List all branches in a Git repository
Code: ```python
import os
os.system('git branch')
``` | Python_Core | flytech_python_vault | 1,789,452,018.76977 |
Instruction: Create a ZIP archive of a folder
Code: ```python
import shutil
folder_name = input('Enter the folder name to zip: ')
shutil.make_archive(folder_name, 'zip', folder_name)
``` | Python_Core | flytech_python_vault | 1,789,452,018.769888 |
Instruction: Push changes to a GitHub repository
Code: ```python
import os
branch_name = input('Enter the branch name: ')
commit_message = input('Enter the commit message: ')
os.system(f'git add . && git commit -m "{commit_message}" && git push origin {branch_name}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.770021 |
Instruction: Start a local web server
Code: ```python
import os
port = input('Enter the port number: ')
os.system(f'python -m http.server {port}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.770142 |
Instruction: Create an HTTP server to share files
Code: ```python
import http.server
import socketserver
PORT = 8000
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(('', PORT), Handler) as httpd:
print(f'Serving at port {PORT}')
httpd.serve_forever()
``` | Python_Core | flytech_python_vault | 1,789,452,018.770271 |
Instruction: Create a symbolic link
Code: ```python
import os
src = input('Enter the source file path: ')
dest = input('Enter the destination link path: ')
os.symlink(src, dest)
``` | Python_Core | flytech_python_vault | 1,789,452,018.770391 |
Instruction: Extract the text content from a webpage
Code: ```python
import requests
from bs4 import BeautifulSoup
url = input('Enter the URL: ')
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
text = soup.stripped_strings
print(' '.join(text))
``` | Python_Core | flytech_python_vault | 1,789,452,018.77051 |
Instruction: Extract all email addresses from a text file
Code: ```python
import re
file_path = input('Enter the text file path: ')
with open(file_path, 'r') as f:
content = f.read()
emails = re.findall(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b', content)
print(emails)
``` | Python_Core | flytech_python_vault | 1,789,452,018.770628 |
Instruction: Check for updates of a specific Python package
Code: ```python
import os
package_name = input('Enter the Python package name: ')
os.system(f'pip search {package_name}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.770745 |
Instruction: Remove trailing whitespaces from a Python file
Code: ```python
file_path = input('Enter the Python file path: ')
with open(file_path, 'r+') as f:
lines = f.readlines()
f.seek(0)
for line in lines:
f.write(line.rstrip() + '\n')
f.truncate()
``` | Python_Core | flytech_python_vault | 1,789,452,018.770862 |
Instruction: Convert tabs to spaces in a Python file
Code: ```python
file_path = input('Enter the Python file path: ')
with open(file_path, 'r+') as f:
content = f.read().replace('\t', ' ')
f.seek(0)
f.write(content)
f.truncate()
``` | Python_Core | flytech_python_vault | 1,789,452,018.770995 |
Instruction: Sort the import statements alphabetically
Code: ```python
import re
file_path = input('Enter the Python file path: ')
with open(file_path, 'r+') as f:
lines = f.readlines()
imports = sorted([line for line in lines if line.startswith('import') or line.startswith('from')])
rest = [line for line i... | Python_Core | flytech_python_vault | 1,789,452,018.77112 |
Instruction: Break lines longer than 80 characters
Code: ```python
file_path = input('Enter the Python file path: ')
with open(file_path, 'r+') as f:
lines = f.readlines()
f.seek(0)
for line in lines:
if len(line) > 80:
parts = [line[i:i+80] for i in range(0, len(line), 80)]
... | Python_Core | flytech_python_vault | 1,789,452,018.771239 |
Instruction: Convert a Python file to PEP8 standards
Code: ```python
import os
file_path = input('Enter the Python file path: ')
os.system(f'autopep8 --in-place {file_path}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.771368 |
Instruction: Add type annotations to function arguments
Code: ```python
file_path = input('Enter the Python file path: ')
with open(file_path, 'r+') as f:
lines = f.readlines()
f.seek(0)
for line in lines:
if 'def ' in line:
line = line.replace('(', '(', 1).replace(')', ': Any)', 1)
... | Python_Core | flytech_python_vault | 1,789,452,018.771488 |
Instruction: Remove all comments from a Python file
Code: ```python
file_path = input('Enter the Python file path: ')
with open(file_path, 'r+') as f:
lines = [line for line in f.readlines() if not line.strip().startswith('#')]
f.seek(0)
f.writelines(lines)
f.truncate()
``` | Python_Core | flytech_python_vault | 1,789,452,018.771606 |
Instruction: Remove all print statements from a Python file
Code: ```python
file_path = input('Enter the Python file path: ')
with open(file_path, 'r+') as f:
lines = [line for line in f.readlines() if 'print(' not in line]
f.seek(0)
f.writelines(lines)
f.truncate()
``` | Python_Core | flytech_python_vault | 1,789,452,018.771725 |
Instruction: Add docstrings to all functions
Code: ```python
file_path = input('Enter the Python file path: ')
with open(file_path, 'r+') as f:
lines = f.readlines()
f.seek(0)
for line in lines:
if 'def ' in line:
f.write('"""Function description."""\n')
f.write(line)
f.trunc... | Python_Core | flytech_python_vault | 1,789,452,018.771843 |
Instruction: Implement a simple feedforward neural network
Code: ```python
import torch
import torch.nn as nn
import torch.optim as optim
class SimpleNN(nn.Module):
def __init__(self):
super(SimpleNN, self).__init__()
self.fc1 = nn.Linear(10, 5)
self.fc2 = nn.Linear(5, 1)
def forward(sel... | Python_Core | flytech_python_vault | 1,789,452,018.771975 |
Instruction: Implement an advanced feedforward neural network using PyTorch and train it
Code: ```python
import torch
import torch.nn as nn
import torch.optim as optim
# Neural Network
class AdvancedNN(nn.Module):
def __init__(self):
super(AdvancedNN, self).__init__()
self.fc1 = nn.Linear(10, 128)
... | Python_Core | flytech_python_vault | 1,789,452,018.772104 |
Instruction: Visualize the activations of a neural network layer
Code: ```python
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.keras.models import Model
model = tf.keras.models.load_model('my_model.h5')
layer_outputs = [layer.output for layer in model.layers]
activation_model = Model(inputs=mo... | Python_Core | flytech_python_vault | 1,789,452,018.772228 |
Instruction: Implement a GAN to generate new data samples
Code: ```python
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Reshape, Flatten
# Generator
G = Sequential()
G.add(Dense(128, activation='relu', input_dim=100))
G.add(Dense(784, activation='sigmoid'))
G.add(Reshape((28,... | Python_Core | flytech_python_vault | 1,789,452,018.772361 |
Instruction: Extract features from an image using a pre-trained CNN
Code: ```python
from tensorflow.keras.applications import VGG16
from tensorflow.keras.preprocessing import image
from tensorflow.keras.applications.vgg16 import preprocess_input
import numpy as np
model = VGG16(weights='imagenet', include_top=False)
im... | Python_Core | flytech_python_vault | 1,789,452,018.772482 |
Instruction: Implement a Random Forest Classifier using scikit-learn
Code: ```python
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_iris
X, y = load_iris(return_X_y=True)
clf = RandomForestClassifier(n_estimators=100)
clf.fit(X, y)
``` | Python_Core | flytech_python_vault | 1,789,452,018.772601 |
Instruction: Create a TensorFlow model to recognize handwritten digits
Code: ```python
import tensorflow as tf
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
model = tf.keras.models.Sequential([tf.keras.layers.Flatten(input_shape=(28,28)), tf.keras.layers.Dense(128, activation=... | Python_Core | flytech_python_vault | 1,789,452,018.772722 |
Instruction: Create a K-means clustering model to segment customers
Code: ```python
from sklearn.cluster import KMeans
import numpy as np
X = np.array([[1, 2], [5, 8], [1.5, 1.8], [8, 8], [1, 0.6], [9, 11]])
kmeans = KMeans(n_clusters=2)
kmeans.fit(X)
``` | Python_Core | flytech_python_vault | 1,789,452,018.772841 |
Instruction: Implement a Naive Bayes classifier for text classification
Code: ```python
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
corpus = ['hello world', 'hello AI', 'I love programming']
vectorizer = CountVectorizer()
X = vectorizer.fit_transform(corpus)... | Python_Core | flytech_python_vault | 1,789,452,018.772973 |
Instruction: Implement a simple chatbot using Python's NLTK library
Code: ```python
import nltk
from nltk.chat.util import Chat, reflections
pairs = [(r'hi', 'hello'), (r'how are you', 'I am fine')]
chatbot = Chat(pairs, reflections)
chatbot.converse()
``` | Python_Core | flytech_python_vault | 1,789,452,018.773096 |
Instruction: Implement a Python script to control a robotic arm
Code: ```python
import pyfirmata
board = pyfirmata.Arduino('COM3')
it = pyfirmata.util.Iterator(board)
it.start()
arm = board.get_pin('d:10:s')
arm.write(90)
``` | Python_Core | flytech_python_vault | 1,789,452,018.773213 |
Instruction: Implement reinforcement learning for a maze-solving bot
Code: ```python
import gym
env = gym.make('FrozenLake-v0')
state = env.reset()
for _ in range(1000):
action = env.action_space.sample()
state, reward, done, info = env.step(action)
if done:
break
``` | Python_Core | flytech_python_vault | 1,789,452,018.773339 |
Instruction: Implement a linear regression model using scikit-learn
Code: ```python
from sklearn.linear_model import LinearRegression
import numpy as np
X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
y = np.dot(X, np.array([1, 2])) + 3
reg = LinearRegression().fit(X, y)
``` | Python_Core | flytech_python_vault | 1,789,452,018.773457 |
Instruction: Create a neural network for natural language processing using PyTorch
Code: ```python
import torch
import torch.nn as nn
import torch.optim as optim
class NLPNet(nn.Module):
def __init__(self, vocab_size, embed_dim):
super(NLPNet, self).__init__()
self.embedding = nn.Embedding(vocab_siz... | Python_Core | flytech_python_vault | 1,789,452,018.773577 |
Instruction: Implement a decision tree classifier to predict loan approval
Code: ```python
from sklearn.tree import DecisionTreeClassifier
X = [[0, 0], [1, 1]]
y = [0, 1]
clf = DecisionTreeClassifier()
clf = clf.fit(X, y)
``` | Python_Core | flytech_python_vault | 1,789,452,018.773694 |
Instruction: Implement a Support Vector Machine for binary classification
Code: ```python
from sklearn import svm
X = [[0, 0], [1, 1]]
y = [0, 1]
clf = svm.SVC()
clf.fit(X, y)
``` | Python_Core | flytech_python_vault | 1,789,452,018.773812 |
Instruction: Create a Python script for sentiment analysis using TextBlob
Code: ```python
from textblob import TextBlob
text = 'I love programming'
blob = TextBlob(text)
sentiment = blob.sentiment.polarity
``` | Python_Core | flytech_python_vault | 1,789,452,018.77393 |
Instruction: Implement a logistic regression model for churn prediction
Code: ```python
from sklearn.linear_model import LogisticRegression
X = [[0, 1], [1, 0], [2, 2]]
y = [0, 1, 0]
clf = LogisticRegression().fit(X, y)
``` | Python_Core | flytech_python_vault | 1,789,452,018.774062 |
Instruction: Implement a neural network for image recognition using OpenCV
Code: ```python
import cv2
net = cv2.dnn.readNetFromCaffe('deploy.prototxt', 'weights.caffemodel')
image = cv2.imread('image.jpg')
blob = cv2.dnn.blobFromImage(image, 1.0, (224, 224), (104.0, 117.0, 123.0))
net.setInput(blob)
preds = net.forward... | Python_Core | flytech_python_vault | 1,789,452,018.774181 |
Instruction: Create a Python script to simulate a PID controller
Code: ```python
class PID:
def __init__(self, Kp, Ki, Kd):
self.Kp = Kp
self.Ki = Ki
self.Kd = Kd
def compute(self, setpoint, measured_value):
error = setpoint - measured_value
return self.Kp * error
``` | Python_Core | flytech_python_vault | 1,789,452,018.77431 |
Instruction: Implement a genetic algorithm for solving optimization problems
Code: ```python
import random
def fitness(individual): return sum(individual)
def mutate(individual): individual[random.randint(0, len(individual) - 1)] = 1 - individual[random.randint(0, len(individual) - 1)]
population = [[random.randint(0, ... | Python_Core | flytech_python_vault | 1,789,452,018.77443 |
Instruction: Implement a Python script for anomaly detection using Isolation Forest
Code: ```python
from sklearn.ensemble import IsolationForest
X = [[0, 1], [0, -1], [-1, 0], [1, 0], [0, 0]]
clf = IsolationForest().fit(X)
``` | Python_Core | flytech_python_vault | 1,789,452,018.774546 |
Instruction: Implement a Principal Component Analysis for feature reduction
Code: ```python
from sklearn.decomposition import PCA
X = [[1, 2, 3], [2, 4, 5], [3, 6, 7]]
pca = PCA(n_components=2)
X_new = pca.fit_transform(X)
``` | Python_Core | flytech_python_vault | 1,789,452,018.774664 |
Instruction: Implement a k-Nearest Neighbors algorithm for classification
Code: ```python
from sklearn.neighbors import KNeighborsClassifier
X = [[0], [1], [2], [3]]
y = [0, 0, 1, 1]
neigh = KNeighborsClassifier(n_neighbors=3)
neigh.fit(X, y)
``` | Python_Core | flytech_python_vault | 1,789,452,018.774783 |
Instruction: Implement a Python script to perform web scraping and data extraction
Code: ```python
import requests
from bs4 import BeautifulSoup
response = requests.get('https://example.com')
soup = BeautifulSoup(response.text, 'html.parser')
title = soup.find('title').get_text()
``` | Python_Core | flytech_python_vault | 1,789,452,018.7749 |
Instruction: Scrape the data from https://sharegpt.com/c/4qj1DB0 and put into a dataset scraped_data.csv
Code: ```python
import requests
from bs4 import BeautifulSoup
import pandas as pd
response = requests.get('https://sharegpt.com/c/4qj1DB0')
soup = BeautifulSoup(response.text, 'html.parser')
title = soup.find('title... | Python_Core | flytech_python_vault | 1,789,452,018.775033 |
Instruction: Fetch the latest gaming news and display them interactively
Code: ```python
import requests
choice = input('Enter the gaming category you are interested in: ')
response = requests.get(f'https://api.example.com/gaming-news/{choice}')
gaming_news = response.json()['articles']
for i, article in enumerate(gami... | Python_Core | flytech_python_vault | 1,789,452,018.775151 |
Instruction: Monitor CPU and GPU temperature and alert if it's too high
Code: ```python
import psutil
threshold = float(input('Enter the temperature threshold for alert: '))
while True:
cpu_temp = psutil.sensors_temperatures()['coretemp'][0].current
gpu_temp = psutil.sensors_temperatures()['nvidia'][0].current
... | Python_Core | flytech_python_vault | 1,789,452,018.775279 |
Instruction: Automatically update game mods based on user choice
Code: ```python
import os
mod_choice = input('Enter the mod name you want to update: ')
os.system(f'curl -O https://example.com/mods/{mod_choice}.zip')
os.system(f'unzip {mod_choice}.zip -d /path/to/game/mods/')
``` | Python_Core | flytech_python_vault | 1,789,452,018.7754 |
Instruction: Fetch and display live game scores based on user's choice
Code: ```python
import requests
game = input('Which game scores would you like to see? ')
response = requests.get(f'https://api.example.com/live-scores/{game}')
scores = response.json()['scores']
for score in scores:
print(f'Team A: {score['team... | Python_Core | flytech_python_vault | 1,789,452,018.775523 |
Instruction: Optimize game settings interactively based on hardware specs
Code: ```python
import psutil
choice = input('Would you like to optimize game settings based on CPU? (yes/no): ')
if choice.lower() == 'yes':
if psutil.cpu_count() > 4:
os.system('echo high > /path/to/game/settings.txt')
else:
... | Python_Core | flytech_python_vault | 1,789,452,018.775642 |
Instruction: Suggest a game to play based on mood
Code: ```python
mood = input('How are you feeling today? (relaxed/excited/sad): ')
game_suggestions = {'relaxed': 'Stardew Valley', 'excited': 'Rocket League', 'sad': 'Undertale'}
print(f'You should play {game_suggestions.get(mood, 'Any game you like')}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.775761 |
Instruction: Change game settings to dark mode if it's night time
Code: ```python
from datetime import datetime
if datetime.now().hour > 18:
os.system('echo dark_mode=True > /path/to/game/settings.txt')
``` | Python_Core | flytech_python_vault | 1,789,452,018.775878 |
Instruction: Mute all background apps while gaming
Code: ```python
import os
confirm = input('Do you want to mute all background apps? (yes/no): ')
if confirm.lower() == 'yes':
os.system('nircmd muteappvolume * 1')
``` | Python_Core | flytech_python_vault | 1,789,452,018.77601 |
Instruction: Display a summary of my gaming stats
Code: ```python
import json
game = input('Which game stats would you like to see? ')
with open(f'/path/to/{game}_stats.json', 'r') as f:
stats = json.load(f)
for key, value in stats.items():
print(f'{key}: {value}')
``` | Python_Core | flytech_python_vault | 1,789,452,018.776132 |
Instruction: Find online co-op games available now
Code: ```python
import requests
response = requests.get('https://api.example.com/coop-games')
games = response.json()['games']
for i, game in enumerate(games):
print(f'{i+1}. {game['name']}')
choice = int(input('Select a game to know more about: '))
print(games[cho... | Python_Core | flytech_python_vault | 1,789,452,018.776259 |
Instruction: Check if any of my Steam friends are online
Code: ```python
import requests
steam_id = input('Enter your Steam ID: ')
response = requests.get(f'https://api.steampowered.com/ISteamUser/GetFriendList/v1?key=YOUR_KEY&steamid={steam_id}')
friends = response.json()['friendslist']['friends']
online_friends = [fr... | Python_Core | flytech_python_vault | 1,789,452,018.776382 |
Instruction: Suggest a game based on my mood and genre preference
Code: ```python
mood = input('What is your mood? (Happy, Sad, Excited): ')
genre = input('What is your favorite genre? (Action, Adventure, RPG): ')
if mood == 'Happy' and genre == 'Action':
print('You should play Super Mario Odyssey.')
``` | Python_Core | flytech_python_vault | 1,789,452,018.776521 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 1,020