def create_present(): n = sid("Please enter the name of the gift:") p = sid("Please enter the price of: {0}.".format(n)) u = sid("Please enter the url/location to purchase: {0}.".format(n)) temp_present = Present(n, p, u) presents.append(temp_present) return temp_present
def get_name(): name = sid("Please enter your name: ").lower() return name
def details(self): return "\nName: {0}\nPrice: ${1}\nUrl/Location: {2}\n".format(self.name, self.price, self.url) def create_present(): n = sid("Please enter the name of the gift:") p = sid("Please enter the price of: {0}.".format(n)) u = sid("Please enter the url/location to purchase: {0}.".format(n)) temp_present = Present(n, p, u) presents.append(temp_present) return temp_present c = sid( "\nWhat would you like to do with your christmas list?\n\nWould you like to:\n\t1)Read List\n\t2)Add Present\n\t3)Delete List\n\nPlease enter the number corresponding to the options: " ) c = int(c) if c == 1: f = open(file_name, "r") smd(None, f.read()) f.close() elif c == 2: p = create_present() pres = p.add_present() elif c == 3: ans = sid("\nAre you sure you want to delete your Christmas list? Enter either 'y/n': ") if ans == "y": os.remove(os.path.realpath(file_name)) smd(None, "\nYour Christmas List has been deleted.") else: