Python Forum

Full Version: Storm Hurricane Tracker (NEED HELP ASAP)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need help with a hurricane tracker program I am working on that I think you guys might be able to help me with!
I can use help via skype if possible or any way you wish!

I have the image posted below, the rubric, and the python code I have for it.. I am confused on where to begin. I am an amateur in python but understand most of the terminology and syntax I just do not understand this project completely and could really use the help as I wish to do good on this project and get a good grade in school. Any help is appreciated.
 
Skype: zak.rowton

[Image: world_map.jpg]


Rubric: Rubric Download Link (PDF File)


def open_file():
filename = input("Input a file name: ") # Prompt for file name, open file, return file pointer
try:
fp = open(filename) # Opens filename if found and throws exception if not found
except FileNotFoundError:
print("Unable to open file. Please try again.")
fp = open_file()
except:
print("Error: Unknown, Please try again...")
return fp # Returns the file


def update_dictionary(dictionary, year, hurricane_name, data):
'''Remember to put a docstring here'''
pass


def create_dictionary():
'''Remember to put a docstring here'''
pass


def display_table(dictionary, year):
'''Remember to put a docstring here'''
pass
# print("{:^70s}".format("Peak Wind Speed for the Hurricanes in " + year))
# print("{:15s}{:>15s}{:>20s}{:>15s}".format("Name","Coordinates","Wind Speed (knots)","Date"))


def get_years(dictionary):
'''Remember to put a docstring here'''
pass


def prepare_plot(dictionary, year):
'''Remember to put a docstring here'''
pass
# create everything that is required for plotting
# return names, coordinates, max_speed


def main():
open_file()
'''Remember to put a docstring here'''
# print("Hurricane Record Software")
# print("Records from {:4s} to {:4s}".format(min_year, max_year))
# input("Enter the year to show hurricane data or 'quit': ")
# input("\nDo you want to plot? ")
# names, coordinates, max_speed = prepare_plot(dictionary, year)
# plot_map(year, size, names, coordinates)
# plot_wind_chart(year, size, names, max_speed)
# print("Error with the year key! Try another year")
pass


if __name__ == "__main__":
main()
File Contents for storm_track1.txt :
You need to state clearly what you have tried, the output you get versus the output you expect and any error codes in their entirety. We are happy to help you, but we will not write the code for you. By the way, the code you posted has no indentation. Try using "Ctrl + Shift + v" when pasting between the code tags, this should maintain any indentation.
If you are really struggling, you need to break this down into simple steps.

You have the basic bones of the programme (although it is hard to check the formatting is correct as it is not pasted in correctly and has lost indentation, which is CRITICAL in Python).

Assuming you have the first part like this:
def open_file():
    filename = input("Input a file name: ") # Prompt for file name, open file, return file pointer
    try:
        fp = open(filename) # Opens filename if found and throws exception if not found
    except FileNotFoundError:
        print("Unable to open file. Please try again.")
        fp = open_file()
    except:
        print("Error: Unknown, Please try again...")
    return fp # Returns the file
the file should open correctly.

Why not just write the code to output to the screen the file you have opened, just to make sure of that bit.

(Incidentally, calling the function open_file() from within itself, line 7, is called recursion and is probably not the right choice here. Would be better to have a loop that keeps going until a file has been opened.)