My first Python projects for beginners

To be a data analyst I need to be good in the general purpose language of Python. For the past couple of weeks I’ve been taking online classes on Datacamp and Udacity and it’s been lots of fun learning.

Learning to code is akin to learning a new language, it takes time and lots practice and the most important of them all, it should be fun and it has been lots of fun so far.

But why am I writing this here? Because of all the benefits of keeping a journal. I really want to see my progress and this is a great way of keeping it all in one place, it may help someone out there who would like to join my path in the future, it’s a great way to self-reflect and it’s the perfect outlet, I have this desire to share for some reason and rather than questioning it i prefer to yield to it. Lastly, I’d like to put together a portfolio of relevant projects for my future prospective employers. :-) I doesn’t hurt to be honest, right?

The projects below were meant to give me a start into coding with python, by learning to bring all I had learnt so far together as a beginner.

Project 1- Dice Rolling Simulator

Code — Dice Rolling Simulator

The above was relatively easy, as I didn’t spend too much time on it including research, but I learned a lot here.

  • Define the expressions for your while loops before your start defining your loop
  • I learnt how to accept keyboard inputs via the .input() method
  • I learnt how to generate random numbers by importing the “random” package, and specifically via the “randint” module within the package

Project 2- Guess the number

Code — Guess the number

This took me a little longer to finish but there were many lessons to be learnt here:

  • On top of the previous lessons, I really got to understand how the “While” and “if” loops can work together
  • I got to learn how to get out of a loop using the “break” keyword
  • I got to learn how to compare different user inputs
  • I got to understand the difference between the “While” and “If” loops. The former, continues to execute the code block for however long the expression is true. The latter, checks if the expression is true and runs the code once only if it’s true.
  • I finally got to understand how to ensure a certain input is a certain specific data type i.e. x =int(x) ensures x is an integer type

Project 3-Mad Libs Generator

It was really funny learning what Mad Libs are and how they work. The final results were also hilarious

Code — Mad Libs Generator

This was by far the easiest of them. It mainly involved concepts around concatenation, print() and variables. Which are concepts I had well grasped at this point in time.

This is my final project for today, but the list doesn’t end here. Like I said, constant practice is the key to success.

I believe the quality of the work above is not up to acceptable industry standards of programming, but i’m just getting started.

One thing that’s for sure is that I’ll improve progressively, to ensure I produce high quality code that’s up to industry standard.

Ref- Source of the projects above — Thank you NorthWestern Team!

Cheers to all aspiring data analysts and scientists out there! :-)