f-strings in python
f-strings are basically strings that contain parameters in curly brackets.They are of great use when people use many print statements and have to define various strings that contains other variables. Let me show you what I mean-
If I made a text based number guessing game and I had to print '
(number entered) is the number I guessed and you guessed it in (times) times' once the user gave the correct number, I could do this-
- always has f before the string. ex- f"{1}"
-always the parameters are passed in curly brackets
Comments
Post a Comment