Your First Lines of Code in Python

Your First Lines of Code in Python

I am going to describe to you a method that I use with my clients when I teach Python & Data Science ↓

Jesús López's photo
Jesús López
·Sep 28, 2021·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Programming is hard, especially at the beginning.

Don't make it yourself any harder!

Start with Data Visualization.

It's easier to understand programming with visual changes than abstract coding ("make a program that prints even numbers").

Get on Jupyter, a code editor. Here is the link to [download the program](anaconda.com/products/individual.

Your first lines of code should be as follows:

import seaborn as sns

df = sns.load_dataset('tips')
sns.scatterplot(x='total_bill', y='tip', data=df)

You would get a plot that should look like this one ↓

plot.jpg

To configure the behaviour of the function, you should configure the code as follows:

sns.scatterplot(x='total_bill', y='tip', data=df, color='red')

plot.jpg

This simple change helps you to understand a couple of core concepts in programming:

  1. Functions sns.scatteplot() are used to make things in programming (a plot in this case).

  2. You use parameters color='red' to configure the function's behaviour.

Feel free and welcome to ask me anything in the comments below, it will be my pleasure to help you out 🤗

 
Share this