标签:【澳门新蒲】
  • Leap Year checker

    Leap Year checker

    标签:澳门新蒲 2019-06-16
    import sysimport stringdef julian_leap(y=2000): if (y%4) == 0: return 1 return 0def gregorian_leap(y=2000): if (y@0) == 0: return 1 elif (y0) == 0: return 0 elif (y%4) == 0: return 1 return 0 years = [1999,2000,2001,1900] print julian_leap(...
  • A programmer-defined exception class.

    A programmer-defined exception class.

    标签:澳门新蒲 2019-06-16
    import mathclass NegativeNumberError( ArithmeticError ): passdef squareRoot( number ): if number 0: raise NegativeNumberError, 'Square root of negative number not permitted' return math.sqrt( number )while 1: try: userValue = float( raw_inp...
共1页/2条