In the code below:
def modify_note(self):
id = input("Enter a note id: ")
memo = input("Enter a memo: ")
tags = input("Enter tags: ")
if memo:
self.notebook.modify_memo(id, memo)
if tags:
self.notebook.modify_tags(id, tags)
memo and tags are string type variables. How can you write them after if, does python regard them as boolean here?
The
if memoandif tagsstatements are checking the truthiness of thememoandtagsvariables.