Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lm3226/assignment7.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self, interval_input):

def validate_input(user_string):
if type(user_string) is not str:
raise InvalidUserInputException("interval_input must be a string")
raise InvalidUserInputException("Interval_input must be a string")

def __set_left_interval(self, user_input):
if user_input[0] == "[":
Expand Down Expand Up @@ -98,7 +98,6 @@ def main():
user_input = input("Please enter a list of intervals separated by ', ': ")
if "quit" in user_input:
sys.exit(0)
print(user_input)
user_input_list = user_input.split(', ')
interval_list = transform_string_list_to_intervals(user_input_list)

Expand All @@ -119,5 +118,10 @@ def main():
except InvalidIntervalException:
print("Invalid interval(s). Please separate intervals by a comma followed by a space, as in '[1,2], [3,4]'")

except KeyboardInterrupt:
sys.exit(0)
except EOFError:
sys.exit(0)

if __name__ == '__main__':
main()