TO FIND THE NEXT OR DIFFERENT PROJECT CLICK ON THE SEARCH BUTTON ON THE TOP RIGHT MENU AND SEARCH USING COURSE CODE OR PROJECT TITLE.

Starting from:
$30

$19.50

Solved Python Exercise 6 Capital Quiz (30 pts)

Write a program that quizzes the users on their knowledge of state capitals. You can access the list of states and capitals using the following link (or any other reliable Internet source.) https://en.wikipedia.org/wiki/List_of_capitals_in_the_United_States Your program should randomly quiz the user by displaying the name of a state and asking the user to enter the state’s capital. The program should keep track of the number of correct and incorrect answers. The program should also offer a sentinel to stop the quiz. (Review section 4.2 in the zyBook to recap the use of sentinels.) Your code should include: 1. A dictionary to store the states and their capitals as key value pairs 2. A random number generator to randomize the states referenced • You may think it would be useful to retrieve the index of the dictionary to help with randomizing the questions. However, dictionaries require keys not indices to retrieve a value. You can overcome this by converting the dictionary to a list using list() so you can retrieve indices. 3. A while loop to stop the game. The program should indicate what the sentinel is so that the user can stop the game at any time. • The while loop should include an if elif structure to keep track of the user’s correct and incorrect answers A sample of the output is shown below: What is the capital of Nevada? (or enter q to quit): Carson City That is correct. What is the capital of Hawaii? (or enter q to quit): Honolulu That is correct. What is the capital of Utah? (or enter q to quit): Salt Lake City That is correct. What is the capital of Louisiana? (or enter q to quit): Baton Rouge That is correct. What is the capital of Connecticut? (or enter q to quit): Hartford That is correct. What is the capital of Arkansas? (or enter q to quit): Little Rock That is correct. What is the capital of Washington? (or enter q to quit): Seattle That is incorrect. What is the capital of Georgia? (or enter q to quit): Atlanta That is correct. What is the capital of Illinois? (or enter q to quit): q You had 7 correct responses and 1 incorrect responses. Tip: • Functions are not required for this question. Encrypting code (30pts) Write a program that uses a dictionary to encrypt a text file. You can use the dictionary provided below or modify it to create your own version. Encrypt_Code = {'A':')','a':'0','B':'(','b':'9','C':'*','c':'8',\ 'D':'&','d':'7','E':'^','e':'6','F':'%','f':'5',\ 'G':'$','g':'4','H':'#','h':'3','I':'@','i':'2',\ 'J':'!','j':'1','K':'Z','k':'z','L':'Y','l':'y',\ 'M':'X','m':'x','N':'W','n':'w','O':'V','o':'v',\ 'P':'U','p':'u','Q':'T','q':'t','R':'S','r':'s',\ 'S':'R','s':'r','T':'Q','t':'q','U':'P','u':'p',\ 'V':'O','v':'o','W':'N','w':'n','X':'M','x':'m',\ 'Y':'L','y':'l','Z':'K','z':'k','!':'J','1':'j',\ '@':'I','2':'i','#':'H','3':'h','$':'G','4':'g',\ '%':'F','5':'f','^':'E','6':'e','&':'D','7':'d',\ '*':'C','8':'c','(':'B','9':'b',')':'A','0':'a',\ ':':',',',':':','?':'.','.':'?','<':'>','>':'<',\ "'":'"','"':"'",'+':'-','-':'+','=':';',';':'=',\ '{':'[','[':'{','}':']',']':'}'} Your program should read an input file, encode the text using the dictionary provided, and write the result to a text file. Use a function to encrypt the file. The function should accept the contents of the file (as a string) and return the encrypted contents. Tips: • For variety, you may prompt the user to enter the name of an input file as well as choose the name of their output file (instead of hardcoding the names of the files). Make sure to include the extension (text files are preferred.) • Spaces should NOT be converted. You can use the isspace() method to check for spaces to retain them in your converted file. o You can access the definition of isspace here: https://docs.python.org/3/library/stdtypes.html • You only need to submit the python code. (No need to include the text files.)