Quick actions

cmd+k|ctrl+k

Navigation

Languages

format-strings

Snippet info

Language

Python

Visibility

public

Author

narutouzumakiramen18

Created

2026-05-02T18:00:20.831782Z

Updated

2026-05-02T18:10:33.651677Z

name = "rafaath"
age = 23

# print("Hello " + name + " I am "+ str(age) + " Years old!")

# The above method is a pain in the ass as we need to type convert shit and also 
# if we want to extend and add values and strings it might be a pain in the ass.
# Due to this reason we use a formatted strings.

print(f"Hello {name}, you are {age} years old")
# The above code is a lot cleaner compared to the 4th line code!

# In python 2 we had something different, this works on python 3 as well - .format
print("Hello {1}, you are a pussy at {0} years old".format(name,age))
# as nums start from 0.
INFO