File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -369,8 +369,8 @@ for thing in things:
369369```
370370
371371Measure how long it takes for the user to answer a question.
372- The ` % .2f` rounds to 2 decimals, and you can find more formatting
373- tricks [ here] ( https://pyformat.info/ ) .
372+ The ` {: .2f} ` rounds to 2 decimals, and you can find more formatting
373+ tricks [ here] ( https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals ) .
374374
375375``` python
376376import time
@@ -381,7 +381,7 @@ end = time.time()
381381difference = end - start
382382
383383if answer == ' 3' :
384- print (" Correct! That took % .2f seconds." % difference )
384+ print (f " Correct! That took { difference : .2f} seconds. " )
385385else :
386386 print (" That's not correct..." )
387387```
@@ -410,7 +410,7 @@ Check what a path points to.
410410import os
411411import sys
412412
413- print (" You are currently in %s . " % os.getcwd())
413+ print (f " You are currently in { os.getcwd()} . " )
414414
415415while True :
416416 path = input (" A path, or nothing at all to quit: " )
You can’t perform that action at this time.
0 commit comments