mysql-connector-java-5.1.41-bin.jar is located at the same directory as q1.py . Notes: • If you see errors like this: UnicodeEncodeError: 'ascii' codec can't encode character u'\xf4' in position 1 , add the following to the beginning of your script: import sys reload(sys) sys.setdefaultencoding('utf-8') Questions (each is worth 20 points) : All orders are ascending. 1. List name and capital of countries each of which has more than 100 cities (recorded in the database). Order the list by country name. 2. Find name of the country which has the largest GNP. 3. Find names of countries whose official languages include English and French.
INF 551 – Spring 2017 4. Find names of countries where English is an official language but not French. 5. For each continent, compute the average population of countries in the continent. Order the result by continent name. Output format: List the records in the result by lines, one record per line. If the record has multiple fields, separate the fields by a tab . For example, the q1.py may return the following results: Afghanistan 4 Albania 1 Algeria 18 ... Submission : Name your scripts as q1.py, q2.py and so forth, and compress them into a zip file named <FirstName>_<LastName>_hw5.zip as usual. Don’t add name prefix to the Python scripts inside. Please post further questions on Blackboard .
You've reached the end of your free preview.
Want to read both pages?
- Fall '14
- Official language, scripting language