import smtplib

# Set up email sender and recipient
sender = "your_email_address"
recipient = "info@rx-it.com"

# Set up quiz questions and answers
questions = ["Which of the following should you do to restrict access to your files and devices?",
"Backing up important files offline, on an external hard drive or in the cloud, will help protect your business in the event of a cyber attack. True or False?",
"Which is the best answer for which people in a business should be responsible for cybersecurity?",
"Cyber criminals only target large companies. True or False?",
"Which of the following is the best answer for how to secure your router?",
"Which of the following scenarios does NOT describe a tech support scam?",
"True or False? You can avoid scams by only taking tech support calls from well-known tech companies.",
"Which of these answers describes the best way to protect against tech support scams?",
"True or False? Small businesses should focus more on other cybersecurity threats, because tech support scammers usually target only large companies.",
"Which is the best way to protect against viruses or other security threats?"]

answers = ["D", "True", "D", "False", "D", "D", "False", "D", "False", "A"]

# Set up function to send email with quiz results
def send_email(answers_correct):
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(sender, 'your_password')
message = f"Subject: Quiz Results\n\nYou got {answers_correct} out of 10 questions correct."
server.sendmail(sender, recipient, message)
server.quit()

# Set up function to run quiz and check answers
def run_quiz():
answers_correct = 0
for i in range(len(questions)):
print(f"\nQuestion {i+1}: {questions[i]}")
user_answer = input("Enter your answer: ")
if user_answer.upper() == answers[i]:
print("Correct!")
answers_correct += 1
else:
print("Incorrect.")
send_email(answers_correct)

# Run the quiz
run_quiz()