What do you call this in python? | Sololearn: Learn to code for FREE!

+3

What do you call this in python?

name = "kylie" print(f"your name is {name}") what do you call the {} thingy? i mean the term in programming. is that something like a place holder or what? Tnx

4/14/2021 10:45:25 AM

Kakai

4 Answers

New Answer

+6

As per your example, it's used for formatting string. And to use {} as a place holder, it's important to write 'f' before the string. Or you can do in these ways too. https://www.sololearn.com/learn/Python/2455/?ref=app Happy Coding : )

+4

Yeah, reminds me of javascript, it is calling the variable or function in the "curly braces". It is similar to the .format() syntax. I believe f-strings rolled out in python 3.6 F-string Syntax: https://realpython.com/python-f-strings/

+2

The thingy's called curly braces. In your code it's used to format a string, as already stated. But in Python they're also used for dictionaries and sets. You'll learn about it in the Python tutorials. Happy coding!

+1

Thanks guys.