Python Syntax to Know as Data Scientist - Part 1
Python is definitely one of, if not the simplest?programming language to learn. Free online courses like this one by Codecademy and this one by freeCodeCamp are good resources to start learning Python. Once you have learnt the basics, you will need to keep practicing, ideally through projects while working towards building more intermediate and advanced Python programming skills.
Here is a quick overview of some of the Python syntax you should know to help you get started on your data science journey:
Variables
Python variables are pretty simple to instantiate. Variables are basically data storage for information during a program’s execution. To create a Python variable, you just assign it a value using the assignment operator, for example, the equal to sign (=).
N.B: Comments can be added to your Python code and those are not executed when run. Single line comments start with the hash symbol (#).
Conditionals
Conditionals are used to evaluate expressions to True or False. They are used to control the process flow of the program. A Python conditional statement can be made up of an if condition, an if and else condition or an if, elif and else conditions.?These can also be nested.
N.B: The condition should always end with a colon (:) and the block of code within the conditional statement should always be indented.
领英推荐
Loops
Loops are used to traverse over a container. A container can be in the form of a list or any data entity that holds a set of entities. The syntaxes below are examples of how to do simple for loops over a list and a range of values.
Functions
Functions are reusable blocks of code that perform a task. Functions, by design, can take in and return information. There are many inbuilt Python functions like max(), range() and abs(). However, the flexibility of Python allows you to write your own functions whenever you want to.
Python is a vital skill to have in your data science toolbox so the time investment to develop your Python programming skills will be worth it over time.
Want to learn more about my tech journey as well as useful resources and opportunities for people who are new to the field? Be sure to?follow me on LinkedIn?so you don’t miss any of my upcoming posts.
FMVA?||Actuarial Science||Aspiring Data Scientist & Financial Analyst||Black Sisters In STEM ||Continuos Growth||
3 年Thanks Ivy
Deep learning | image processing | computer vision |medical imaging
3 年Thanks for sharing Ivy
Senior Associate at KPMG Ghana
3 年Recommendation : https://www.netacad.com/courses/programming/pcap-programming-essentials-python