This blog explains string formatting in Python.

The traditional way of string formatting is as below where we use + sign to format strings.

language = "Python"
print("Welcome to " + language + " Programming!")

Output: Welcome to Python Programming!

Though this approach is used by many beginners, it becomes difficult to use + sign in case of complicated strings. So, to avoid the complexity, the next approach followed is using str.format().

language = "Python"
print("Welcome to {} Programming!".format(language))

Output: Welcome to Python Programming!

Since Python 3.6, string formatting is further made easier, concise and faster by using f-Strings.

f-strings have f-prefix. Below example illustrate the use of f-strings for string formatting.

language = "Python"
print(f'Welcome to {language} Programming!')

Output: Welcome to Python Programming!

Thanks for reading and have a good day :)

--

--

Scatter plots are used to represent the relationship between feature variable and target variable while target variable is plotted on X-axis and feature variable on Y-axis.

Scatter plots define correlation between two variables.

Here, I am using JupyterLab IDE.

import pandas as pd

%matplotlib inline

#Reading dataframe
df = pd.read_csv(“/filepath/diabetes.csv”)
df.plot(kind = “scatter”, x= “BMI”, y= “Age”)

Scatter Plot for BMI and Age

Link to the dataset I have used — diabetes.csv

Thanks for reading. Have a good day :)

--

--