Reputation: 33
i'm learning python from a book that i bought in 2017 and from a online course at the same time.
The book says that i should format the string like this example;
print("Guess number %d of %d" % (variable1, variable2))
But the online course says that i should format this way;
print("Guess number {} of {}".format(variable1, variable2))
Which one should i use for today programming standards?
Upvotes: 3
Views: 69
Reputation: 44
I'd predict the use are f-strings are aimed at readability. That said, i would say the real answer is which ever one is more readable in your function or whatever.
Upvotes: 1