File tree 1 file changed +4
-4
lines changed
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:
369
369
```
370
370
371
371
Measure 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 ) .
374
374
375
375
``` python
376
376
import time
@@ -381,7 +381,7 @@ end = time.time()
381
381
difference = end - start
382
382
383
383
if answer == ' 3' :
384
- print (" Correct! That took % .2f seconds." % difference )
384
+ print (f " Correct! That took { difference : .2f} seconds. " )
385
385
else :
386
386
print (" That's not correct..." )
387
387
```
@@ -410,7 +410,7 @@ Check what a path points to.
410
410
import os
411
411
import sys
412
412
413
- print (" You are currently in %s . " % os.getcwd())
413
+ print (f " You are currently in { os.getcwd()} . " )
414
414
415
415
while True :
416
416
path = input (" A path, or nothing at all to quit: " )
You can’t perform that action at this time.
0 commit comments