Core Python Data Types and Functions
Start course

This course offers an introduction to data science and looks at what a data scientist does. It then moves on to data science in Python and, through a range of guided walkthroughs, shows you how to use Python and its features. You will learn how to set up Anaconda and Jupyter Notebook and learn, using real-world examples, how to write Python code in Jupyter, with useful tips within the context of data science.

The course also looks at object-oriented planning, as well as Python variables and Python functions, and finally, it takes a look at Python data types and functions.

Learning Objectives

  • Understand data science and the role of data scientist
  • Set up Anaconda and Jupyter notebooks
  • Improve your knowledge of coding with Python
  • Understand how to work with Python variables, functions, and data

Intended Audience

This course is intended for:

  • Individuals looking for an introduction to data science
  • Those looking to enhance their knowledge of Python and its features


To get the most from this course, you should already have some knowledge of Python and programming languages in general.


Hello, and welcome back. So, terminology-wise, things that we should be aware of are types in Python. If you ask what the type of an object is, it refers to the class that was used to create the object, and what a class is, is simply an outline of what the object should look like when it's made. When we think of objects, we literally think of an object that you can hold in your hand, that can do certain things, and that has certain attributes. It has properties and it can do things. It's the best way to think about an object or entered (ph 00.33) programme. I just want to make absolutely certain that we really understand this because it's much more simple than you think. So, Python is built around this object or entered structure, this idea for designing a language. Okay, so, let's do some Python then. So, we have two types of cell, one being a markdown cell and the other being a code cell. In markdown cells, that's where we write our various text elements. When it comes to navigation, if you're in a cell, you will have a green bar or a green box around your current cell. This means you're in edit. We can do things in here and they will have an effect when we actually run those things. So, everything I do in here is actually happening because I have a green box around my cell, as you can see. Now, if I want to run a cell, and you have to run both markdown and code cells, I use the keyboard shortcut Ctrl and Enter to run it. Ctrl and Enter is one of the best shortcuts to memorise. Once I've run my cell, I will be taken out into edit mode, or command mode, and it's in command mode where we can actually begin to navigate between cells. So, when I'm in command mode, if I use the up and down, things will start moving. 

If I want to add a cell, then I can use A to add a cell above, I can use B to add a cell below. This simply adds in a new, and by default, code cell. Okay, so, once we've added a few cells, we should be able to navigate between them using up or the down arrow. So, by default, we have a code cell. So, if I want to turn my code cell into a markdown cell, I can use the M key, and what you'll notice when you use the M key is that the input bit on the left hand side will disappear, and then, when you go into it and you write things like 'print hi' or something, nothing will happen because this is just text. This is text input. So, once you've run your markdown cells, I've run this several times now and nothing changes obviously, if you want to revert back to being a code cell, you hit the Y key. Y takes you back to a coding cell. So, now, when I run this, what I get is a Python error, an invalid syntax error, because what I've written makes no sense whatsoever. When I'm in a code cell, what are some extra things that we can talk about? So, in markdown, we've got these various formatting elements available to us. I'm going to chuck some of them on the screen. I'll chuck in what we've had a look at so far. So, to change our font sizes, we can use a hash, we can use the hash character. That changes between various HTML header sizes. So, we can list, we can use asterisks. To run or compile the markdown again, it's Ctrl and Enter, and when we're in command mode, enter edit mode, we hit Enter. When we want to get out of a cell without running it, we hit Escape. Do you want to run the cell again? Ctrl Enter. Add a cell below, yes, we saw that before. 

To delete a cell, we can hit D twice. That gets rid of it forever, or we can hit X which cuts it out, but you only have to hit X once. So, only use X if you're confident that you're not going to make mistakes. There's a wealth of material on how to work with markdown. So, these are some of the things that we can do in markdown. I've got my headers, I've got my list, making something bold, double underscore is a way of doing that. You can embed LaTeX. So, we can embed something called LaTeX into our markdown which means that we can get lovely Pi symbols and things like that. To do that, we just have to use a dollar sign, so we can actually just embed proper LaTeX code in there. It's one of my favourite things about Jupyter. We can actually write code to be displayed in a syntactically correct fashion using back-ticks or back-quotes. They're those speech marks you normally find at the top left hand side of the keyboard, and I can write Python code that I can have evaluate itself syntactically correctly when I run it according to Jupyter. So, I've said that this is to be formatted as Python code, and it has been formatted as Python code. I haven't run this code, I'm just displaying it visually as if it were code in Jupyter. So, that's enough about markdown. We'll dabble more with markdown later on. Right now, we care more about our code cells. If we've managed to take note of these things, then it's useful. If you get anything when you're in command mode, hit H and you'll get a list of every shortcut you can imagine, like this. So, it's just the H key, like for help. When you ask for help, you'll get a list of every possible keyboard shortcut. I've just taken a sub-sample of these which I find useful regularly.

About the Author

Delivering training and developing courseware for multiple aspects across Data Science curriculum, constantly updating and adapting to new trends and methods.

Covered Topics