Does anyone have homeworks for learning Python?

I’m at 30% completion on Python Mastery and I’m not happy with the lack of homework / hands-on exercises. I’m more of a hands-on learning type of person.

Does someone have exercises that I can solve?

You can always work on algorithms from leetcode.com. They might be a little tough, but you’ll learn essential skills in manipulating data.

If you just want a couple pet-projects that you can build, that would depend on your skill level. But some ideas below are easier, some are larger. In the beginning, it’s best to practice loops and data types. Then learn things like databases, pandas, etc.

Best first side-project: Create a snippets app. Put examples of everything you’ve learned there. Basically a collection of modules. Each module demonstrates one thing. One for declaring different types of variables. One module for different types of loops. Etc. Everything you learn, create a live working demonstration of it in a module. This becomes a great reference for you as you document the language you are learning.

Here are some other ideas:

  1. Create a password generator that creates a random password that includes 2-4 uppercase letters, 2-4 lowercase letters, 2-4 numerics, and 2-4 symbols and creates a password of length 8 to 16 characters long.

  2. Create a simple game with a text interface. Ideas might include:

  • dice - roll two dice and display them.

  • cards - generate 52 playing cards. Randomize them. Then deal one hand of five cards. Finally, display a message if there are a high card, a pair, two pair, three of a kind, full house, straight, straight flush, or royal flush.

  • hangman - create a long list of words - perhaps cities or states - put them into a dictionary. Then choose one at random and interact with the user for letters and solving the puzzle before a hangman is drawn.

  1. Create small business application / utilities.
  • Convert a CSV to JSON using existing python libraries. Then try to implement the same thing without using common libraries. Parse the file yourself. Then write your JSON to disk. Then extend it to store your data in a MySQL database, then into a MongoDB database, then into a SQLite database. So you have experience with all those tools.

  • Web scraper app that can find products on amazon.com and capture the product image, title, id, price, and review information. At first just to query one specific product and later to query the top five items that match a search criteria. TIP: make sure you put a delay in between web queries so you don’t end up getting blocked for hammering the website. Wait 2 seconds before each query.

  • Write a script that gathers specific information about your computer. How many files are there. Which files are the largest. You could dump the data into a database and then do a variety of searches for file names, extensions, dates, etc. It might be nice to show which folders hold the largest amount of data. If you are familiar with disk utilities or memory utilities, try to replicate some of that functionality in your own scripts.

Jerry