How To Make A Todo List In Python

How To Open Command Prompt Using Python
Table of Contents

Today we will make a project in python which is a todo list in python we will see how to make a todo list in python you will get the source code of the project down below.

This is a simple todo list in python you can create todo’s, remove them and see all your todos you have added it is great project for beginners you can try to create if you can’t you can follow this article.

If you want more coding projects you can check my projects at coderzway projects I upload awesome projects like this and you can get the code or source of the projects for free I will upload more projects in the future do stay with us.

So let’s start making a todo list app in python.

Making todo list app in python

So before starting you need have atleast basic knowledge of python to understand this and you need to have python installed on your computer and a code editor if you don’t have python installed you can download it from here – download python.

I use vs code for writing and editing code it is really great I will recommend you also to use this you can download vs code from here – download vs code.

Create a python file

So first you need to create a python file for writing and running python file you have to create a .py file you can create a seperate folder and create the file there.

Open your command prompt just keep it open we will require it later and open the file in a code editor vs code or any other editor.

Copy and paste

Now you have created the file now you need to copy this code and paste it the python file

				
					# Todo list with python by coderzway

todos = []
is_quit = False
show = True

while is_quit == False:
  index = - 1 
  if show == True:
    print(f'type - help - To see commands ')
    print(f'type - st - To show todos ')
    print(f'type - ct - To create todos ')
    print(f'type - rt - To remove todos ')
    print(f'type - q - To quit the todo ')
    print('')
    show = False
  res = input('What you want to do : ')
  
  if res == 'ct':
    todo = str(input('Enter a the name of the todo : '))
    print('Todo added')
    todos.append(todo)
  
  elif res == 'st':
      if len(todos) <= 0:
          print('No todos added') 
      else:  
          for t in todos:
              print(f'- {t}')
              print('-----------------------------------------------------')  
  
  elif res == 'rt':
      if len(todos) <= 0:
          print('No todos added') 
      else:  
          for t in todos:
              print(f'- {t}')
              print('-----------------------------------------------------')
          rTodo = input('Enter the name of the todo to delete : ')
          try:
            tt = todos.remove(rTodo)
            print('Todo removed')  
          except:
              print('No todo found with that name')  
  
  elif res == 'q':
        is_quit = True
        break 

  elif res == 'help':
        print(f'type - help - To see commands ')
        print(f'type - st - To show todos ')
        print(f'type - ct - To create todos ')
        print(f'type - rt - To remove todos ')
        print(f'type - q - To quit the todo ')

  else:
      print('Please enter a valid value')

				
			

Now you have to run this file so you have opened or you have to open command prompt at your file location if you are using vs code you can just click the run button and file will run.

In the command prompt type this command python filename.py this will run the file and enter the name of your python file

Output

How To Open Command Prompt Using Python

So this is the output

How to use

1 – It will ask you what you want to do you can use this commands
– Type ct for creating a todo
– Type rt for removing a todo
– Type st for showing all your todos
– Type help for all commands
– Type q for quiting the app
2 – Enter the above commands and add, see or remove todos

So this was the python project on making a todo list with python This project was simple and easy if you have created it own your own congrats.

Thanks for reading this article and if you want more projects like this do subscribe to coderzway email list you will get updates whenever we upload a new project.

Share This Post
Share on facebook
Share on twitter
Share on email
Share on whatsapp

Leave a Reply

Subscribe To Our Newsletter

Get updates and learn from the best

Latest Guides & Articles