Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corrected the newsletter section #1271

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 29 additions & 23 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2802,35 +2802,41 @@ button:disabled{
}

#newsletter {
padding: 10px;
}
display: flex;
flex-direction: column; /* Arrange items vertically */
height: auto; /* Allow height to adjust based on content */
padding: 20px; /* Optional padding for spacing */
}

#newsletter .news-text {
width: 50%;
}
#newsletter .news-text {
margin-bottom: 20px; /* Space between text and form */
}

#newsletter .news-text h4 {
font-size: 18px;
}
#newsletter .news-text h4 {
font-size: 22px;
}

#newsletter .news-text p {
font-size: 16px;
}
#newsletter .news-text p {
font-size: 18px;
}

#newsletter .news-form {
width: 48%;
}
#newsletter .news-form {
display: flex;
flex-direction: column;
width: 100%;
}

#newsletter .news-form input {
padding: 0px 2px;
height: 20px;
font-size: 12px;
}
#newsletter .news-form input {
height: 2rem;
font-size: 14px;
margin-bottom: 10px;
}

#newsletter .news-form button {
font-size: 8px;
padding: 0px 6px;
}
#newsletter .news-form button {
width: 100%;
text-align: center;
font-size: 10px;
padding: 2px 6px;
}

@media (max-width: 400px) {
Expand Down
47 changes: 47 additions & 0 deletions tempCodeRunnerFile.python
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import math

def classifyAPoint(points,p,k=3):
distance=[]
for group in points:
for feature in points[group]:

#calculate the euclidean distance of p from training points
euclidean_distance = math.sqrt((feature[0]-p[0])**2 +(feature[1]-p[1])**2)

# Add a tuple of form (distance,group) in the distance list
distance.append((euclidean_distance,group))

# sort the distance list in ascending order
# and select first k distances
distance = sorted(distance)[:k]

freq1 = 0
freq2 = 0

for d in distance:
if d[1] == 0:
freq1 += 1
elif d[1] == 1:
freq2 += 1

return 0 if freq1>freq2 else 1

# driver function
def main():



points = {0:[(1,12),(2,5),(3,6),(3,10),(3.5,8),(2,11),(2,9),(1,7)],
1:[(5,3),(3,2),(1.5,9),(7,2),(6,1),(3.8,1),(5.6,4),(4,2),(2,5)]}

# testing point p(x,y)
p = (2.5,7)

# Number of neighbours
k = 3

print("The value classified to unknown point is: {}".\
format(classifyAPoint(points,p,k)))

if __name__ == '__main__':
main()