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
# Question 1 | |
list1 = [] | |
for i in range(20): | |
if i % 2 == 0 or i % 4 == 0: | |
list1.append(i) | |
# Question 2 | |
def square(x): | |
return x ** 2 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 pandas as pd | |
from sklearn.model_selection import train_test_split | |
from sklearn.neighbors import KNeighborsClassifier | |
# Load the data for the recommendation system | |
data = pd.read_csv("posts.csv") | |
# Select the relevant columns for the ML model | |
X = data[["hashtags", "time_spent"]] |
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 socket | |
# Create a socket object | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
# Get the local machine name | |
host = socket.gethostname() | |
# Set the port number | |
port = 12345 |
OlderNewer