1) Write a Python program that prints the frequencies of words in the text file. Your output should be similar to the one shown below (same alignments and table-like format). Submit your (1) program and (2) a snapshot (picture of at least first 7 words in your table) of your results.
2) Write a Python program that reads the text from the file and writes its translation in the file hw8PirateOutput.txt. Use the translation described by Pb.4.3 from pg. 153. Note: in your output file you are allowed to have all words in lower case. Submit the (1) python code and (2) the file hw8PirateOutput.txt.
3) Write a Python program that verifies the check digit of Universal Product Codes (UPC).
The Universal Product Codes on almost all purchase items utilizes a bar code to allow for the scanning of items. Below the bar code is the sequence of digits that the bar code encodes, as illustrated below.
The last digit of the product code (2) is a check digit computed as follows.
- Add up all digits in the odd numbered positions excluding the last check digit, and multiply the result by 3.
- Add up all digits in the even numbered positions excluding the last check digit.
- Take the sum of the two previous results modulo 10.
(42+16) modulo 10 = 8
- Subtract the result from 10 to get the checksum digit.
The file contains many UPCs. Your program must read them from the file, and for each UPC it must display True if the check digit verifies as described above; otherise it displays False. Take a snapshot of your output similar to the one below, and upload it with your homework. Submit ypur (1) Python code and (2) a snapshot (picture) of your results.
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: [email protected] 微信：dmxyzl003 工作时间：无休息工作日-早上8点到凌晨3点