Question: Assignment 2 Each exercise is 5 points 2.1 pick_my_strings.py random strings-[Xerox', 'wall', 'trust','follow', blurb', 'news','gig , maroon', 'pop', 'wow', 'ready. . salad', 'yummy'. 'go', 'flow',

Assignment 2 Each exercise is 5 points 2.1 pick_my_strings.py random strings-[Xerox', 'wall', 'trust','follow', blurb', 'news','gig , maroon', 'pop', 'wow', 'ready. . salad', 'yummy'. 'go', 'flow', 'evidence'] Use the random strings list above to iterate over it and create a new list that contains only strings with length of 4 or more characters and whose first and last characters are the same. As a result you should end up with the list like below. [7]: my_strings [7]: xerox', 'trust', 'blurb', 'yummy', 'evidence'] 2.2 get_russia_tweets.py Use python to read trump tweets.txt and extract only the tweets related to Russia. Write out the extracted tweets into a trump russia_tweets.txt document. Upload both your script and txt document to Slack Note: 'related to Russia' in this assignment means that Russia is mentioned in the tweet in any context. 2.3 Locate Bronx Stations In this exercise your job is to print the names of the train stations located in different zones. The data for stations is given to you in the Bx_stations.csv. Read in the data and store it in the list or named tuple, whatever you prefer. Then iterate over the data and based on the lat & lon coordinates, add the station id and station name to one of the four lists: NW, NE, SW, or SE. Print the name & id of the stations from the lists. Use the map below and the Cutoff values to determine zones. Cutoff values that correspond to the centroid of the Bronze North-South NScutoff 40.852635 East-West EWcutoff-73.866531 For example: Station with ID 101 and name Van Cortland Park is at 40.8892479 lat and -73.898583 lon. I can determine based on these coordinates that it is in the NW zone. You would need to use Il/Else (possibly nested If statements) to determine it in a loop. You should determine if a) the lat coordinate is North or South of the center latitude (stored in NScutoff variable) AND b) if the lon coordinate is East or West of the center longitude (stored in EWcutoff variable) c) Based on the criteria you should add the ID and NAME of the station to correct list []: N - 0 NEO SW - 0 SE - 0 print("The ids and names of the North-West train stations are: ", NW) print("The ids and names of the North-East train stations are: ". NE) print("The ids and names of the South-West train stations are: ", SW) print("The Ids and names of the South-East train stations are: SE)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
