A fun Project/Exercise while learning Python, or any New language

A fun Project/Exercise while learning Python, or any New language

A fun exercise in Python: Command line Directory Indexer

Here is a fun exercise to learn any new language, like Python in this case. I do this as one of the first things while learning a new language: Write a utility for yourself in that language.

I have done this when I was learning MS PowerShell, Julia, and Python.

Here is one of my favorite utilities.

Command line Directory Indexer

Write a command line python program which does the following:

  1. Assign a set of symbolic names for key directories on your hard drive that you want to remember
  2. Prompt the set of symbolic names in a numbered list
  3. Pick a number
  4. Change the directory in the command line to the targeted directory
  5. Make use of that directory in some way useful to you. For example in windows you can "start ." to start a new File Explorer in that directory
  6. Bonus: Execute commands like “run vscode” as one of the pseudo directory names but instead invoke a program
  7. Bonus2: Use a csv file on a hard drive to define the symbolic names
  8. Bonus3: Use the program to add/delete/update symbolic names

Time frame

You should be able to do this in a couple of hours. Bonus work may take a few more hours and some planning.

Concepts covered by this Exercise

This exercise covers

  1. Writing variables and functions
  2. Using data structures
  3. Read and write CSV files
  4. Work with command line

You can use ChatGPT as your assistant

?Use ChatGPT to prompt you the code for each function ??

Practical use of the utility

I have over a dozen different programming systems installed on the laptop. When I take a gap from one system to another, I forget where I have installed these programs and what key directories I kept the source code.

The directories can be personal directories like photos, documents, repos, or whatever.

I call this utility "chdirs.cmd" which is set in the path. This allows me to remember all the important past and present directories.

About the Picture

Female Tree Deity with Attendant, About 973 Sandstone, NW India, Rajasthan, Sikar, Harshagiri - Cleveleand Museum of Art

Cross Reference

要查看或添加评论,请登录

Satya Komatineni的更多文章

社区洞察

其他会员也浏览了