# @aartii.py on Instagram

- **Type:** Video
- **Original URL:** https://www.instagram.com/p/DW4S7EmD1LB
- **Gondola URL:** https://gondola.cc/posts/63668185-aartiipy-instagram
- **Thumbnail:** https://img.gondola.cc/tr:w-,h-,fo-auto/postThumbnails/6f681bf2e7.jpg
- **Posted:** 2026-04-08T17:49:06.000+00:00
- **Account Owner:** Aarti Sinha (@aartii.py) — https://gondola.cc/aartii.py

## Caption

I was writing this:
“Hello “ + name + “, you are “ + str(age) + “ years old.”

Then I found out Python had a cleaner way. I’ll never go back.

It’s called an f-string.

Put an f before the quote. Write your variable inside curly braces.
f”Hello {name}, you are {age} years old.”

Read it like a sentence. That’s the whole thing.

3 things that make f-strings genuinely powerful:
→ Expressions: f”Sum: {5 + 3}” → Sum: 8
→ Rounding: f”Pi: {3.14159:.2f}” → Pi: 3.14
→ ML output: f”Accuracy: {acc:.1%}” → Accuracy: 94.3%

That last one — compare this:
“Accuracy: “ + str(round(acc*100,1)) + “%”

With this:
f”Accuracy: {acc:.1%}”

Same output. One is readable.

One rule: the f goes BEFORE the quote.
That’s genuinely all there is to learn.

Day 9 of learning Python for data science — documenting everything so you have a shortcut I didn’t.

Were you using string concatenation before f-strings? Drop it below.
#Python
#Fstrings
#PythonTips
#LearnPython
#DataScience
PythonForBeginners
aartii_py
MachineLearning
WomenInTec

## Stats

- **Views:** 865
- **Likes:** 0
- **Shares:** 0
- **Comments:** 30

## Tags

python, learnpython, pythontips, fstrings, datascience

---
Copyright (c) Gondola