Skip to main content
added 101 characters in body
Source Link
Rod
  • 18.4k
  • 4
  • 31
  • 89

Pyth, 78 67 bytes

 l-6.d9

Try it online!Try it online!

Explanation

    .d9 # Get the current day of week (0 = Monday, 6 = Sunday)
  -6    # Subtract 6 from the day
 l      # Try to calculate the log base 2 of the result of the previous operation raising a "ValueError: math domain error" on sundays
        # raisingthere ais "ValueError:an mathextra domainspace error"at the start, to supress the output on sundaysthe other days

Pyth, 7 6 bytes

l-6.d9

Try it online!

Explanation

   .d9 # Get the current day of week (0 = Monday, 6 = Sunday)
 -6    # Subtract 6 from the day
l      # Try to calculate the log base 2 of the result of the previous operation
       # raising a "ValueError: math domain error" on sundays

Pyth, 8 7 bytes

 l-6.d9

Try it online!

Explanation

    .d9 # Get the current day of week (0 = Monday, 6 = Sunday)
  -6    # Subtract 6 from the day
 l      # Try to calculate the log base 2 of the result of the previous operation raising a "ValueError: math domain error" on sundays
        # there is an extra space at the start, to supress the output on the other days
deleted 285 characters in body
Source Link
Rod
  • 18.4k
  • 4
  • 31
  • 89

Pyth, 77 6 bytes

/1l-6.d9

Try it online!

Explanation

    .d9 # Get the current day of week (0 = Monday, 6 = Sunday)
  -6    # Subtract 6 from the day
/1l      # DivideTry 1to bycalculate the log base 2 of the result of the previous operation
        # raising a "ZeroDivisionError" on sundays

Try it online!

###Another 7 bytes solution

.(U6.d9

Try it online!

Explanation

  U6    # Create a list with 6 elements
.(  .d9 # Try to pop"ValueError: themath 7thdomain elementerror" on sundays
        # raising "IndexError"

Pyth, 7 bytes

/1-6.d9

Explanation

    .d9 # Get the current day of week (0 = Monday, 6 = Sunday)
  -6    # Subtract 6 from the day
/1      # Divide 1 by the result of the previous operation
        # raising a "ZeroDivisionError" on sundays

Try it online!

###Another 7 bytes solution

.(U6.d9

Try it online!

Explanation

  U6    # Create a list with 6 elements
.(  .d9 # Try to pop the 7th element on sundays
        # raising "IndexError"

Pyth, 7 6 bytes

l-6.d9

Try it online!

Explanation

   .d9 # Get the current day of week (0 = Monday, 6 = Sunday)
 -6    # Subtract 6 from the day
l      # Try to calculate the log base 2 of the result of the previous operation
       # raising a "ValueError: math domain error" on sundays
added 323 characters in body
Source Link
Rod
  • 18.4k
  • 4
  • 31
  • 89

Pyth, 7 bytes

/1-6.d9

Explanation

    .d9 # Get the current day of week (0 = Monday, 6 = Sunday)
  -6    # Subtract 6 from the day
/1      # Divide 1 by the result of the previous operation
        # raising a "ZeroDivisionError" on sundays

Try it online!

###Another 7 bytes solution

.(U6.d9

Try it online!

Explanation

  U6    # Create a list with 6 elements
.(  .d9 # Try to pop the 7th element on sundays
        # raising "IndexError"

Pyth, 7 bytes

/1-6.d9

Explanation

    .d9 # Get the current day of week (0 = Monday, 6 = Sunday)
  -6    # Subtract 6 from the day
/1      # Divide 1 by the result of the previous operation
        # raising a "ZeroDivisionError" on sundays

Try it online!

Pyth, 7 bytes

/1-6.d9

Explanation

    .d9 # Get the current day of week (0 = Monday, 6 = Sunday)
  -6    # Subtract 6 from the day
/1      # Divide 1 by the result of the previous operation
        # raising a "ZeroDivisionError" on sundays

Try it online!

###Another 7 bytes solution

.(U6.d9

Try it online!

Explanation

  U6    # Create a list with 6 elements
.(  .d9 # Try to pop the 7th element on sundays
        # raising "IndexError"
added 246 characters in body
Source Link
Rod
  • 18.4k
  • 4
  • 31
  • 89
Loading
Source Link
Rod
  • 18.4k
  • 4
  • 31
  • 89
Loading