Python Fundamentals homework

(1) Print “San Diego” 5 times using a control statement AND one or more pass statements within the control statement.

(2) Use a for loop with a range function to loop from 0 to 50. For each iteration, print if the number can be divided by 5 without using a continue statement.

(3) Use a for loop with a range function to loop from 0 to 50. For each iteration, print if the number can be divided by 5 by using a continue statement.

(4) Use a for loop with a range function to loop from 0 to 50. For each iteration, print if the number can be divided by 5. If the number is 18, escape from the loop using a break statement.

(5) Using a while loop, create an echo program that keeps asking a user to input string messages and then print out the message. Stop the program using a break statement if the user’s input value is exactly “EXIT” or “exit”.

(6) Create a list object containing the following integer values. Print an index of the value 8. [1,2,3,4,5,6,7,8,9,10]

(7) Use the list object created in Q(6), print the last element using slicing techniques. GEOG 496 2018/09/05 (Due on 2018/09/12 by 23:59:59, 0 point after due) Page 2

(8) Use the list object created in Q(6), print from the 3 rd element to the 7th element using slicing techniques.

(9) Use the list object created in Q(6), print from the 3 rd element to the last element using slicing techniques.

(10) Create a 2-dimensional list object containing the following two address values. Print the street number and name on the first address. [[“5500 Campanile Dr”, “San Diego”, “CA”, “92182”], [“2920 Zoo Dr”, “San Diego”, “CA”, “92101”]]

(11) Use the list object created in Q(10), print the second, third, and fourth address elements of the second address using list slicing techniques.

(12) Use the list object created in Q(10), append the following address list object using an extend() function. [“3225 N Harbor Dr”, “San Diego”, “CA”, “92101”]

(13) Use the list object created in Q(12), append the following two address list objects using list slicing techniques. [“500 Sea World Dr”, “San Diego”, “CA”, “92109”] [“9500 Gilman Dr”, “La Jolla”, “CA”, “92093”]

(14) Use the list object created in Q(13), remove the address that corresponds to San Diego International Airport using del(). Print the result.

(15) Use the list object created in Q(14), remove the address that do not correspond to Universities using list slicing techniques.

(16) Import a built-in module, random. Use a random() function to generate a random floating point number in the range between 0.0 and 1.0 and print the value. Check the following page for a reference. • https://docs.python.org/3.6/library/random.html?hi…

(17) Find a random module function to generate a random floating point value between two numbers from a uniform distribution. Generate 10 random floating point values between 10 and 20 and print the values using a control statement. • https://docs.python.org/3.6/library/random.html?hi…

(18) Use the random module function used in Q(17). Generate 10 random latitudes and longitudes within San Diego Area (need to define the extent of San Diego Area by yourself) and create a 2- GEOG 496 2018/09/05 (Due on 2018/09/12 by 23:59:59, 0 point after due) Page 3 dimensional list object based on those generated point coordinates.

(19) Install a module, folium, into your PC in SAL by opening a windows command prompt and type the following three commands separately.

C:\Apps\Anaconda3\Scripts\Activate.exe

python -m pip install –upgrade pip

C:\Apps\Anaconda3\Scripts\pip.exe install folium

(20) Import a module, folium, and map those randomly generated point coordinates in Q(18). Check the following folium document. .

 

Last Updated on March 8, 2019 by EssayPro