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 55
66class NegArgError (Exception ):
77 def __init__ (self , name , n ):
8- super (NegArgError , self ).__init__ ()
8+ super ().__init__ ()
99 self .message = 'argument {0} for {1} negative' .format (n , name )
1010
1111
1212class TooLargeArgError (Exception ):
1313 def __init__ (self , name , n ):
14- super (TooLargeArgError , self ).__init__ ()
14+ super ().__init__ ()
1515 self .message = 'argument {0} for {1} too large' .format (n , name )
1616
1717
@@ -46,8 +46,8 @@ def fact(n):
4646 import sys
4747 for n in [3 , 7 , 22 , - 1 ]:
4848 try :
49- print ('{0 }! = {1}' . format ( n , fact (n )) )
49+ print (f' { n } ! = { fact (n )} ' )
5050 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