Assignment 21 — function implementation

Due in class, Friday October 25


Module triple.py


Function inverse( n )

inverse( 4.5 ): -4.5

inverse( -12 ): 12

inverse( 0 ): 0



Function longer( s, t )`

longer( abcd, ef ): abcd

longer( hij, klmnnop ): klmnop

longer( str, int ): str

longer( int, str ): int



Function summation( n )

0 + 1 + ... + n.

summation( 5 ): 15

summation( 1 ) : 1

summation( 0 ): 0


 


 

 

 
   
   
   
 
  © 2019 Jim Cohoon   Resources from previous semesters are available.