Python Forum
Storm Hurricane Tracker (NEED HELP ASAP)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Storm Hurricane Tracker (NEED HELP ASAP)
#3
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.)
I am trying to help you, really, even if it doesn't always seem that way
Reply


Messages In This Thread
RE: Storm Hurricane Tracker (NEED HELP ASAP) - by gruntfutuk - Nov-13-2017, 02:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Could someone help me finish this ASAP JimmyDricks 7 2,368 Dec-23-2021, 10:30 AM
Last Post: Larz60+
  Need help with this homework for a course ASAP...need solution for completion. SP04123 8 5,227 Jun-21-2020, 06:15 PM
Last Post: buran
  really need assistance with this assignment ASAP due tomorrow mohamedhadi02 8 3,755 Jun-21-2020, 09:16 AM
Last Post: mohamedhadi02
  python homework help ASAP gk34332 1 3,048 Mar-13-2019, 07:27 PM
Last Post: ichabod801
  Temperature converter Help (ASAP) Edison_Weng 1 2,906 Apr-16-2018, 01:55 PM
Last Post: stranac
  Quiz Game Help (ASAP Please!) beginnercoder04 2 3,254 Apr-15-2018, 04:13 AM
Last Post: beginnercoder04

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020