I am coding a to-do app, but while matching the menu()
function it gives a Syntax Error, the function returns the number of the option the user selected, this is the code:
# Imports
import time, os, random
from colorama import Fore, Back, Style
# Functions
def menu():
print(f"{Fore.BLUE}To-Do List!")
print(Style.RESET_ALL)
print(f"{Fore.GREEN}[1] ADD ITEM")
print(f"{Fore.RED}[2] REMOVE ITEM")
print(f"{Fore.BLUE}[3] SEE LIST")
option = int(input("Selection > "))
return option
# Variables
newItem = {
"name": "",
"description": "",
"date": "",
"priority": ""
}
todo = []
# Code
match menu():
case 1:
os.system("clear")
print(f"{Fore.GREEN}ADD ITEM TO LIST")
print(Style.RESET_ALL)
newItem["name"] = input("Item name > ")
newItem["description"] = input("Item description > ")
newItem["date"] = input("Item date > ")
newItem["priority"] = input("Item priority (low/med/high) > ")
todo.append(newItem)
print(todo)
input()
How can I solve it?
I tried changing the variable and using the match()
statement a different way, it still has the same error.