Skip to content

Commit da500b6

Browse files
authored
Add files via upload
1 parent b02e8b2 commit da500b6

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

random_quiz.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import random
2+
3+
# The quiz data. Keys are states and values are their capitals.
4+
5+
capitals = {
6+
'Alabama': 'Montgomery', 'Alaska': 'Juneau', 'Arizona': 'Phoenix',
7+
'Arkansas': 'Little Rock', 'California': 'Sacramento', 'Colorado': 'Denver',
8+
'Connecticut': 'Hartford', 'Delaware': 'Dover', 'Florida': 'Tallahassee',
9+
'Georgia': 'Atlanta', 'Hawaii': 'Honolulu', 'Idaho': 'Boise',
10+
'Illinois': 'Springfield', 'Indiana': 'Indianapolis', 'Iowa': 'Des Moines',
11+
'Kansas': 'Topeka', 'Kentucky': 'Frankfort', 'Louisiana': 'Baton Rouge',
12+
'Maine': 'Augusta', 'Maryland': 'Annapolis', 'Massachusetts': 'Boston',
13+
'Michigan': 'Lansing', 'Minnesota': 'Saint Paul', 'Mississippi': 'Jackson',
14+
'Missouri': 'Jefferson City', 'Montana': 'Helena', 'Nebraska': 'Lincoln',
15+
'Nevada': 'Carson City', 'New Hampshire': 'Concord', 'New Jersey': 'Trenton',
16+
'New Mexico': 'Santa Fe', 'New York': 'Albany', 'North Carolina': 'Raleigh',
17+
'North Dakota': 'Bismarck', 'Ohio': 'Columbus', 'Oklahoma': 'Oklahoma City',
18+
'Oregon': 'Salem', 'Pennsylvania': 'Harrisburg', 'Rhode Island': 'Providence',
19+
'South Carolina': 'Columbia', 'South Dakota': 'Pierre', 'Tennessee': 'Nashville',
20+
'Texas': 'Austin', 'Utah': 'Salt Lake City', 'Vermont': 'Montpelier',
21+
'Virginia': 'Richmond', 'Washington': 'Olympia', 'West Virginia': 'Charleston',
22+
'Wisconsin': 'Madison', 'Wyoming': 'Cheyenne'
23+
}
24+
25+
# Generate 35 quiz files.
26+
for quizNum in range(35):
27+
# Create the quiz and answer key files.
28+
quizFile = open('capitalsquiz%s.txt' % (quizNum + 1), 'w')
29+
answerKeyFile = open('capitalsquiz_answers%s.txt' % (quizNum + 1), 'w')
30+
31+
# Write out the header for the quiz.
32+
quizFile.write('Name:\n\nDate:\n\nPeriod:\n\n')
33+
quizFile.write((' ' * 20) + 'State Capitals Quiz (Form %s)' % (quizNum + 1))
34+
quizFile.write('\n\n')
35+
36+
# Shuffle the order of the states.
37+
states = list(capitals.keys())
38+
random.shuffle(states)
39+
40+
# Loop through all 50 states, making a question for each.
41+
for questionNum in range(50):
42+
43+
# Get right and wrong answers.
44+
correctAnswer = capitals[states[questionNum]]
45+
wrongAnswers = list(capitals.values())
46+
del wrongAnswers[wrongAnswers.index(correctAnswer)]
47+
wrongAnswers = random.sample(wrongAnswers, 3)
48+
answerOptions = wrongAnswers + [correctAnswer]
49+
random.shuffle(answerOptions)
50+
51+
# Write the question and the answer options to the quiz file.
52+
quizFile.write('%s. What is the capital of %s?\n' % (questionNum + 1, states[questionNum]))
53+
54+
for i in range(4):
55+
quizFile.write(' %s. %s\n' % ('ABCD'[i], answerOptions[i]))
56+
quizFile.write('\n')
57+
58+
# Write the answer key to a file.
59+
answerKeyFile.write('%s. %s\n' % (questionNum + 1, 'ABCD'[answerOptions.index(correctAnswer)]))
60+
quizFile.close()
61+
answerKeyFile.close()
62+

raw.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sys
2+
3+
password = {
4+
'email': 'eakghfkjiui3urir738iu3rr3yr9',
5+
'blog': 'jjhoidoh8d39urokenfo83uri3m9',
6+
'luggage': '123456'
7+
}
8+
9+
if len(sys.argv) < 2:
10+
print('Usage: py raw.py [account] - copy account password')
11+
sys.exit()
12+
13+
account = sys.argv[1]
14+
if account in password:
15+
pyperclip.copy(password[account])
16+
print('Password for ' + account + ' copied to clipboard.')
17+
18+
else:
19+
print('There is no account named ' + account)

0 commit comments

Comments
 (0)