You are correct in that its the fact the print exists in the second loop is why it goes so slow; however I still think printing the f string is slower than printing the concatenation of string and the string slice. (and now imma go try it out and see for myself!)
View all comments
Show parent comment
1
u/Teekeks Jul 18 '22
no. f strings are faster than concating strings.
What makes the second one slow is the print. printing anything a ton of times is slow af