+ 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

14th Apr 2021, 10:45 AM
Kakai
Kakai - avatar
4 ответов
+ 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/JUMP_LINK__&&__Python__&&__JUMP_LINK/2455/?ref=app Happy Coding : )
14th Apr 2021, 10:55 AM
Scarlet Witch
Scarlet Witch - avatar
+ 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/
14th Apr 2021, 10:52 AM
Steven M
Steven M - avatar
+ 3
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!
15th Apr 2021, 10:33 AM
SpaceBarMönkey
SpaceBarMönkey - avatar
+ 1
Thanks guys.
15th Apr 2021, 11:13 AM
Kakai
Kakai - avatar