Question: Write a program that creates a dictionary containing the Chinese provinces as keys and their capitals as values. (See table below or parse file

Write a program that creates a dictionary containing the Chinese provinces as keys and their capitals as values. (See table below or parse filechinese-provincial-capitals.txt (link) The program should then randomly quiz the user by displayingthe name of a province and asking the user to enter that

Write a program that creates a dictionary containing the Chinese provinces as keys and their capitals as values. (See table below or parse file chinese-provincial-capitals.txt (link) The program should then randomly quiz the user by displaying the name of a province and asking the user to enter that province's capital. The program should keep a count of the number of correct and incorrect responses. PROVINCE CAPITAL Anhui Hefei Fujian Fujian Gansu Lanzhou Guangdong Guangzhou Guizhou Guiyang Hainan Haikou Hebei Shijiazhuang Heilongjiang Harbin Henan Zhengzhou Hubei Wuhan Hunan Changsha Jiangsu Nanjing Jiangxi Nanchang Jilin Changchun Liaoning Shenyang Qinghai Xining Shaanxi Xian Shandong Jinan Shanxi Taiyuan Sichuan Chengdu Yunnan Kunming Zhejiang Hangzhou chinese-provincial-capitals - Notepad File Edit View PROVINCE, CAPITAL Anhui,Hefei Fujian,Fujian Gansu,Lanzhou Guangdong,Guangzhou Guizhou,Guiyang Hainan, Haikou Hebei, Shijiazhuang Heilongjiang,Harbin Henan,Zhengzhou Hubei,Wuhan Hunan,Changsha Jiangsu,Nanjing Jiangxi, Nanchang Jilin,Changchun Liaoning,Shenyang Qinghai,Xining Shaanxi,Xian Shandong,Jinan Shanxi,Taiyuan Sichuan,Chengdu Yunnan Kunming Exercise 3 - (Gaddis 9.3) File Encryption and Decryption Write a program that uses a dictionary to assign "codes" to each letter of the alphabet. For example: >>>|codes = {'A': '%, a:9, B:@,b:#} Using this example, the letter A would be assigned the symbol %, the letter a would be assigned the number 9, the letter B would be assigned the symbol and so forth. The program should open a specified text file, read its contents, and then use the dictionary to write an encrypted version of the file's contents to a second file. Each character in the second file should contain the code for the corresponding character in the first file. Write a second program that opens an encrypted file and displays its decrypted contents on the screen. link for codes that can be used %% @ # 1 P 3 a 5 ^ 7 = 07 {0 [: Z. j % ") ; 2 h~ P 9 $ # ^ 4 ^ 6 ) 8 `} \]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!