Question: Jython, Correct this code to allow and extend it to allow a user to play a guessing game in whch the function randomly picks 10
Jython, Correct this code to allow and extend it to allow a user to play a guessing game in whch the function randomly picks 10 countries 1 by 1 and the user has to guess the capital city.
Your code must meet the following requirements;
User input(s) - Must use requestString and either or both requestInteger or requestNumber
2. if and elif statements
3. while loops to repeat (no for loops)
4. Accessing/modifying values in lists using loops
5. Functions (not all but some must demonstrate taking parameters/arguments, returning values)
6. Creating/reading/writing non-picture files (i.e. not makePicture or writePictureTo).
7. Reading values from webpages (in the style shown in the week 8 lecture but from a different site of your own choosing)
8. Use of the random librarys functions to randomise
import urllib import random def capitalCityGuessingGame(): linkURL="http://techslides.com/demos/country-capitals.csv" #URL to Country and Capitals List webFile = urllib.urlopen(linkURL) lineList=webFile.readlines() webFile.close() # print lineList[0] i=0 while(i menu="Menu:" i=0 while(i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
