.format() is older as it was introduced in python 2.6 while f-string is newer and from python 3.6
F-strings are generally more compact than .format() and easier to decipher but the biggest difference is in the ability for expressions within the f-string to be performed at runtime. This allows for things such as calling functions, creating classes, and math operations.
Ah, okay then. That was really well explained! I've known about a2 + b2 = c**2, and figured that c was the radius, but I was thinking about it the wrong way, in that (either) a or b should have been the radius. Makes more sense that way actually.
Thanks
This comment is hidden because it contains spoiler information about the solution
Thank you so much @stok
Can someone please explain me how the above code works?
.format() is older as it was introduced in python 2.6 while f-string is newer and from python 3.6
F-strings are generally more compact than .format() and easier to decipher but the biggest difference is in the ability for expressions within the f-string to be performed at runtime. This allows for things such as calling functions, creating classes, and math operations.
Additionally, f-strings are faster than .format()
What's the difference between .format() and a f-string?
This comment is hidden because it contains spoiler information about the solution
nice
Thank you very much
This comment is hidden because it contains spoiler information about the solution
Same but with f strings haha
I like this method.
You're welcome!
I like your answer too, thank you for taking the time to explain that!
Ah, okay then. That was really well explained! I've known about a2 + b2 = c**2, and figured that c was the radius, but I was thinking about it the wrong way, in that (either) a or b should have been the radius. Makes more sense that way actually.
Thank you!
Loading more items...