File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 5
5
6
6
class NegArgError (Exception ):
7
7
def __init__ (self , name , n ):
8
- super (NegArgError , self ).__init__ ()
8
+ super ().__init__ ()
9
9
self .message = 'argument {0} for {1} negative' .format (n , name )
10
10
11
11
12
12
class TooLargeArgError (Exception ):
13
13
def __init__ (self , name , n ):
14
- super (TooLargeArgError , self ).__init__ ()
14
+ super ().__init__ ()
15
15
self .message = 'argument {0} for {1} too large' .format (n , name )
16
16
17
17
@@ -46,8 +46,8 @@ def fact(n):
46
46
import sys
47
47
for n in [3 , 7 , 22 , - 1 ]:
48
48
try :
49
- print ('{0 }! = {1}' . format ( n , fact (n )) )
49
+ print (f' { n } ! = { fact (n )} ' )
50
50
except Exception as error :
51
- sys . stderr . write ( '### error: {0} \n ' . format ( error ) )
52
- print ('function name: {0}' . format ( fact .__name__ ) )
53
- print ('function docs: {0}' . format ( fact .__doc__ ) )
51
+ print ( f '### error: { error . message } ' , file = sys . stderr )
52
+ print (f 'function name: { fact .__name__ } ' )
53
+ print (f 'function docs: { fact .__doc__ } ' )
You can’t perform that action at this time.
0 commit comments