html codes
html codes
DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, in
itial-scale=1.0" />
<title>Computer Science Survey Form</title>
<link href="styles.css" rel="stylesheet"/>
</head>
<body>
<h1 id="title">Computer Science Survey Form</h1>
<p id="description">Thank you for finding time to fil
l this form</p>
<form id="survey-form">
<fieldset>
<label id="name-label" for="name">Name</label>
<input
id="name"
type="text"
required
class="formcontrol"
placeholder="Enter your name"
/>
<label id="email-label" for="email">Email</label>
<input
id="email"
type="email"
required
class="formcontrol"
placeholder="Enter your email"
/>
<label id="number-label" for="age">Age(optional)</
label>
<input
id="number"
type="number"
required
class="formcontrol"
min="16"
max="99"
placeholder="Age"
/>
</fieldset>
<fieldset>
<label for="dropdown">Which option best describes
your current role? </label>
<select id="dropdown" name="dropdown" class="
formcontrol">
<option value="">(Select current role)</
option>
<option value="1">Beginner</option>
<option value="2">Intermmediate</option>
<option value="3">Expert</option>
</select>
</fieldset>
<fieldset>
<p> Would you recommend computer science to a fri
end?<p>
<label>
<input
name="recommend"
value="definitely"
type="radio"
class="inline"
checked
/> Definitely</label>
<label>
<input
name="recommend"
value="maybe"
type="radio"
class="inline"
/> Maybe</label>
<label>
<input
name="recommend"
value="not-sure"
type="radio"
class="inline"
</fieldset>
<fieldset>
<p>Any comments or suggestions?</p>
<textarea
id="comments"
class="input-textarea"
name="comment"
placeholder="Enter your comment here..."
></textarea>
</fieldset>
<input id="submit" type="submit" value="Submit" c
lass="submit-button" />
</form>
</body>
</html>
@import url('https://fonts.googleapis.com/css?
family=Poppins:200i,400&display=swap');
body, html {
min-height : 100%;
}
body {
background-image: url(https://images5.content-hci.com/
commimg/myhotcourses/blog/post/myhc_89683.jpg);
font-family: 'Poppins', sans-serif;
font-size: 1rem;
font-weight: 400;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
padding: 20px;
margin: 0;
h1, p {
margin: 1em auto;
text-align: center;
}
form {
width: 100%;
margin: 0 auto;
max-width: 500px;
padding: 20px;
background-color: rgba(27, 27, 50, 0.8);
}
fieldset {
border: none;
padding: 2rem 0;
}
label{
display: flex;
align-items: center;
font-size: 1.125rem;
margin-bottom: 0.5rem;
}
.inline {
display: inline-block;
margin-right: 0.625rem;
min-height: 1.25rem;
min-width: 1.25rem;
}
.formcontrol {
display: block;
width: 100%;
height: 2.375rem;
padding: 0.375rem 0.75rem;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: 0.25rem;
transition: border-color 0.15s ease-in-out, box-shadow
0.15s ease-in-out;
}
.form-control:focus {
border-color: #80bdff;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.input-textarea {
min-height: 120px;
width: 100%;
padding: 0.625rem;
resize: vertical;
}
.submit-button {
display: block;
width: 100%;
padding: 0.75rem;
background-COLOR:#37af65; ;
color:white;
border-radius: 2px;
cursor: pointer;
}
input,
button,
select,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
<table>
<thead>
<th>Name</th>
<th>Age</th>
<th>Program</th>
<th>Level</th>
</thead>
<tbody>
<tr>
<td>Priscilla Obeng</td>
<td>20</td>
<td>Computer Science</td>
<td>300</td>
</tr>
</tbody>
</table>
table{
border: 2px solid pink;
border-collapse: collapse ;
}
td , th{
border: 2px solid red;
padding: 5px;
}
function signUp(newUser) {
if (existingUser) {
return;
users.push(newUser);
// Example usage:
const newUser = {
_id: 'iuytfd',
username: 'John',
email: 'john@example.com',
password: '789789',
isLoggedIn: false
};
signUp(newUser);
The signUp function takes a newUser object as a parameter. It checks if the user already exists in the
users array by comparing the email property. If the user exists, it logs a message informing the user.
Otherwise, it adds the newUser object to the users array and logs a success message.
Note: In this implementation, the users array is mutable, meaning it will be modified directly.
const statistics = {
sample: [],
if (Array.isArray(sample)) {
this.sample = sample;
} else {
},
mean: function () {
if (this.sample.length === 0) {
return null;
},
median: function () {
if (this.sample.length === 0) {
return null;
}
const sortedSample = this.sample.slice().sort((a, b) => a - b);
if (sortedSample.length % 2 === 0) {
} else {
return sortedSample[middleIndex];
},
mode: function () {
if (this.sample.length === 0) {
return null;
let maxFrequency = 0;
frequencyMap[num] = (frequencyMap[num] || 0) + 1;
maxFrequency = frequencyMap[num];
modes.push(parseFloat(num));
}
return modes.length === this.sample.length ? null : modes;
},
range: function () {
if (this.sample.length === 0) {
return null;
},
variance: function () {
if (this.sample.length === 0) {
return null;
);
},
standardDeviation: function () {
if (this.sample.length === 0) {
return null;
}
return Math.sqrt(this.variance());
},
min: function () {
if (this.sample.length === 0) {
return null;
return Math.min(...this.sample);
},
max: function () {
if (this.sample.length === 0) {
return null;
return Math.max(...this.sample);
},
count: function () {
return this.sample.length;
},
if (this.sample.length === 0) {
return null;
return sortedSample[lowerValue];
} else {
const interpolation =
sortedSample[lowerValue] +
(index - lowerValue) *
(sortedSample[upperValue] - sortedSample[lowerValue]);
return interpolation;
},
frequencyDistribution: function () {
if (this.sample.length === 0) {
return null;
frequencyMap[num] = (frequencyMap[num] || 0) + 1;
return frequencyMap;
},
};
// Example usage
statistics.setSample([5, 1, 3, 2, 4, 5, 2, 1, 3, 4, 5]);
console.log("Sample:", statistics.sample);
console.log("Mean:", statistics.mean());
console.log("Median:", statistics.median());
console.log("Mode:", statistics.mode());
console.log("Range:", statistics.range());
console.log("Variance:", statistics.variance());
console.log("Min:", statistics.min());
console.log("Max:", statistics.max());
console.log("Count:", statistics.count());
name: 'Afghanistan',
capital: 'Kabul',
population: 27657145,
flag: 'https://restcountries.eu/data/afg.svg',
},
];
countries.forEach(country => {
country.languages.forEach(language => {
uniqueLanguages.add(language);
});
});
console.log(numLanguages);
function convertArrayToObject(students) {
const studentObj = {
name: name,
skills: skills,
scores: scores
};
convertedArray.push(studentObj);
return convertedArray;
const students = [
];
console.log(convertArrayToObject(students));
const catsAPI = 'https://api.thecatapi.com/v1/breeds';
fetch(catsAPI)
.then(data => {
})
function calculateAverageWeight(weights) {
}, 0);
return averageWeight.toFixed(2);
}
const countriesAPI = 'https://restcountries.com/v2/all';
fetch(countriesAPI)
.then(data => {
});
})
let count = 0;
function plusOne() {
count++
return count
function minusOne() {
count--
return count
return {
plusOne:plusOne(),
minusOne:minusOne()
console.log(innerFuncs.plusOne)
console.log(innerFuncs.minusOne)
Creating a Twitter bot that tweets Chelsea news is a great idea! Here are some additional special
features you can consider adding to enhance your bot's functionality:
1. Real-time updates: Ensure that your bot fetches the latest Chelsea news from reliable sources in real-
time. This can be accomplished by using news APIs or scraping websites that provide up-to-date
information on Chelsea.
2. Content filtering: Implement a content filtering mechanism to ensure that your bot only tweets news
that is relevant and reliable. You can use keywords, trusted sources, or sentiment analysis to filter out
irrelevant or potentially false news.
3. Personalization: Allow users to customize the bot's behavior to some extent. For example, users may
choose to receive news about specific players, match updates, transfer rumors, or other Chelsea-related
topics. This personalization can be done through direct messages or by using specific hashtags in replies
to the bot.
4. Engage with followers: Make your bot more interactive by responding to mentions, retweets, or
direct messages from followers. You can set up automated replies to specific keywords or even include
features like trivia quizzes or polls related to Chelsea.
5. Multimedia content: Don't limit your bot to just text-based tweets. Enhance the user experience by
occasionally including images, videos, or GIFs related to the news you're sharing. This could involve
highlights from matches, player interviews, or behind-the-scenes footage.
6. Scheduled tweets: To ensure consistent activity, consider implementing a scheduling feature that
allows your bot to automatically tweet at specific times of the day or before/after matches. This will
help keep your followers engaged and up to date.
7. Trending topics: Keep an eye on Twitter's trending topics and incorporate them into your bot's tweets
when relevant. This could involve mentioning Chelsea players involved in trending discussions or
providing insights related to current football trends.
8. Notification service: Offer users the option to receive notifications for important Chelsea news or
updates. This can be achieved by implementing a subscription feature where users can opt-in to receive
direct messages or push notifications whenever significant news breaks.
Remember to adhere to Twitter's developer guidelines and terms of service while developing your bot.
Also, be mindful of copyright issues when using content from external sources.
import openai
import feedparser
import tweepy
import random
import time
feed_urls = [
"https://www.chelseafc.com/en/rss.xml",
"https://weaintgotnohistory.sbnation.com/rss/current",
"https://talkchelsea.net/feed/",
openai.api_key = "YOUR_API_KEY_HERE"
consumer_key = "YOUR_CONSUMER_KEY_HERE"
consumer_secret = "YOUR_CONSUMER_SECRET_HERE"
access_token = "YOUR_ACCESS_TOKEN_HERE"
access_token_secret = "YOUR_ACCESS_TOKEN_SECRET_HERE"
# GPT-3 model ID and prompt
model_id = "davinci"
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
# Shuffle the feed URLs to randomize the order in which they are processed
random.shuffle(feed_urls)
def generate_statistics(full_text):
statistics = mbot.generate_statistics(full_text)
plt.plot(statistics)
plt.xlabel('X-axis label')
plt.ylabel('Y-axis label')
plt.title('Data Visualization')
return statistics
feed = feedparser.parse(feed_url)
full_text = entry.get("content")[0].get("value")
response = openai.Completion.create(
engine=model_id,
prompt=f"{prompt}\n{full_text}",
max_tokens=60,
n=1,
stop=None,
temperature=0.5,
summary = response.choices[0].text.strip()
statistics = generate_statistics(full_text)
media = api.media_upload('visualization.png')
api.update_status(status=tweet_content, media_ids=[media.media_id])
# Print confirmation
time.sleep(5)
# Select a specific entry to create a separate tweet with statistics and visualization
separate_full_text = separate_entry.get("content")[0].get("value")
separate_statistics = generate_statistics(separate_full_text)
media = api.media_upload('visualization.png')
api.update_status(status=separate_tweet_content, media_ids=[media.media_id])
# Print confirmation
# Add a delay between separate tweets to comply with Twitter rate limits
time.sleep(5)
api_key = 'Mxb2NOI4gBUvpieozHPkfizd5'
api_secret = "edL0yyhBUCt7rfnAmuZmN3R8B1SlepTc8iQ8EpsFbWE09SkkTc"
bearer_token = 'AAAAAAAAAAAAAAAAAAAAACbUngEAAAAAqRJUaSCOscKO0fAaVcpT50nTSvk
%3DAgMPUWbdGNe8xYXS3Og2tnT2WCw0gmQpaqsNJkAl3vlQGfk53b'
access_token = "1660934714457223170-NcZmTCQIyb4IvMRctkJjIS3OSLLb6z"
access_token_secret = "RWBaWhjXmG2PL00Vs2skDjJKTchrpF7IiWazOmbZHzGkI"