for i in range(1, 100):
print (f'{i}01')
It only works if there is f here, so what is the role of f?
python
There are several ways to format strings in Python. One of them is called f-string. A string with f is replaced by converting the value of the variable into a string by inserting a variable in an interval separated by {}
.
For more information, the official document See https://docs.python.org/ko/3/tutorial/inputoutput.html#formatted-string-literals and other descriptions.
© 2024 OneMinuteCode. All rights reserved.