Everything from syntax, documentation, parameters, and arguments to local and global variables

An open laptop surrounded by photos of cars
Photo by Boitumelo Phetla on Unsplash

Hello, and welcome to my guide to Python user-defined functions. This article will cover the basics of Python user-defined functions, the syntax you must master, and examples to help you consolidate your newly acquired knowledge.


In simple terms, a function takes an input, performs a computation, and produces an output. Python has user-defined functions, anonymous functions, and built-in functions, such as the print() function. I’m sure you will all recognise the print() function as your introductory line of code to the wonderful world of programming.

print("Hello World")
>>> Hello World

Today, however, we are going to focus on user-defined functions…

My Story and Advice


I take it you have exhausted all of your efforts on Google trying to find any information that will be helpful for your upcoming trip to China? You are now praying this article will shine some light on your situation? How do I know this? I was in the same boat as you only a month ago. Hopefully, I can answer a tonne of your questions and relieve some of that pre-travel anxiety by sharing my nightmare of a story.

This will be a semi-informative, semi-experienced based article on the entire process of travelling to China and what to expect…

From Procrastinator to Proactive by Adopting One Habit!

I am writing this article because I was a serial procrastinator. Now, that’s not saying I didn’t get things done, I just wasn’t utilising my time right. I always said I would do this, or do that with no structured organisation. Time just went by, wasted. Time is a precious commodity, so it shouldn’t be mismanaged. All of that changed. With a combination of timing, brotherly advice and coincidental choice of reading material, I have been able to up my productivity tenfold in the last few months. How you ask? Well, that’s what I want to share with you…

If you practice your Python, you will get better. Else, you won’t!

Hello Pythonistas, I hope everyone is staying happy and healthy during these difficult times. For those of you who have been following my blog, welcome back. For our noobcomers, congratulations on starting your Python adventure. Part 5 of my ‘Beginners Guide to Python’ is all about if/elif/else statements. My series on Python is geared towards beginners and I aim to keep things as simple as possible. I will use as little technical jargon as possible, albeit introducing you to these terms without overwhelming you.

Good luck everybody and don’t worry if you find yourself struggling. Even a line of code…

Let Your Coding Journey Begin

Funnily enough, I decided to write this article for my mum. For the past month, I have been writing a ‘Beginners Guide to Python’ with new articles coming out each week. The aim is to help those wanting to start their Python journey. My mum has been following along step by step like the super fan she is. However, she mentioned she couldn’t keep up anymore without a medium to write and execute code on. So voila! This article was born to address that issue.

This article will get you set up on Jupyter Notebook to the point where you…

True or false… While loops have boolean conditions?

looping staircase

Hello Mediumites! I hope everyone is happy, healthy and eager to learn. For those who have been following my ‘Beginners Guide to Python’, welcome back and well done for continuing on your Python journey. Learning something new and alien can be tough. A voice in the back of your mind will be tempting you to quit because it’s too hard, but I encourage you to resist. Even writing one line of code a day counts as learning, and it’ll also help build the habit without being too overwhelming. Anyhoo, today’s article is all about While Loops. While loops are closely…

For loops for noobs. Let's get loopy!


Hello fellow learners, I hope everyone is happy and healthy! Also a big welcome back to those of you who have been following my ‘Beginners Guide to Python’. Today we will crack on with for loops. During the first week or two of my data science boot camp, loops were the bane of my existence. It took me a while to understand the concepts and syntax. The above gif pretty much sums up how I felt during those early weeks. …

Not to be mistaken for the Oxford Dictionary….

Photo by Aaron Burden on Unsplash

Welcome back! I hope you found ‘Beginners Guide to Python, Part1: Lists’ insightful. Even if it only helped a tiny bit, that’s still a win for me! My goal is to help and encourage you on your Python and machine learning journey. It wasn’t too long ago that I was an absolute nooooob at coding. I still consider myself a novice, but with persistence and even 30 minutes a day, you’ll start to see progress.

In our ‘Beginners Guide to Python, Part2: Dictionaries’, we will explore how to use and manipulate Python dictionaries. …

Photo by National Cancer Institute on Unsplash

Hello! My name is Niall and this is my very first data related blog. For the past 10 years, I lived and worked in Beijing, China. Wanting a change and new challenge in life, I decided to relocate to London and pursue a career in data science. I recently finished a data science immersive bootcamp and thought I would like to share my journey and what I learned with other aspiring data scientists. …

Niall McNulty

I’m a junior data scientist who enjoys long-distance running, football, travelling, reading, food, programming… the list could go on. Never stop learning!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store