import math print("Cats ball hard") def Get_Read_File(): """Gets Read File from User and Reprompts for invalid enrty""" while True: try: read_handle = open(input('Please Enter an Input File: ')) return read_handle except FileNotFoundError: print("You've Entered an invalid file name, please try again") def Get_Write_File(): """Gets Write File from User and Reprompts for invalid enrty""" while True: try: write_handle = input('Please Enter an Output File: ') write_handle = open(write_handle, 'w') return write_handle except FileNotFoundError: print("You've entered an invalid output file, please try again.") def Check_Lat_Range(Source_Lat): """Checks Range of Inputed Source Latitude. Must be between -90 and 90, inclusive""" if -90 <= Source_Lat <= 90: return True else: return False def Check_Long_Range(Source_Long): """Checks Range of Inputed Source Latitude. Must be between -180 and 180, inclusive""" if -180 <= Source_Long <= 180: return True else: return False print("I made it here") def Ask_for_Lat_Long(): """Has USER input the Latitude and Longitude of the Source Point""" while True: Source_Lst = [] try: #ErrorHandling for correct format Source_Input = input("Please Enter a Latitude, and Longitude of Source Point in the format: Latitude, Longitude ") Source_Lst = Source_Input.split(',') #split inputed string at the comma Source_Lat = Source_Lst[0] Source_Long = Source_Lst[1] except IndexError: print("Your entry is invalid. Please use a comma to seperate Source Point Latitude, Longitude.") continue try: #ErrorHandling for Latitude. Needs to be a numeric value Source_Lat = float(Source_Lat) except ValueError: print("You must enter a numeric value for Latitude.") continue try: Source_Long = float(Source_Long) except ValueError: print("You must enter a numeric value for Longitude.") continue if Check_Lat_Range(Source_Lat) == False: print("You must enter a value between -90 and 90 for Latitude, inclusive") continue if Check_Long_Range(Source_Long) == False: print("You must enter a value between -180 and 180 for Longitude, inclusive") continue return Source_Lat, Source_Long print("New thing") def testing(): return Ask_for_Lat_Long() testing() testing() testing()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question