Skip to main content
Commonmark migration
Source Link

#Python 2, 74 72 bytes

Python 2, 74 72 bytes

Having already been soundly beaten by @Flp.Tkc I'll just post my 74 72 byte recursive solution because it's different and it works and not because it will win (and also because I like recursive functions).

def f(a,b,c=1):
 print(c,"Shaggy")[c%b<1or`b`in`c`]
 if c<a:f(a,b,c+1)

Edit

-2 by removing the unneeded `` around the c in the print statement

From comments:

Call using

 f(a,b)

c will default to 1 due to the

 c=1

in the function definition and can then be incremented for the recursive function calls.

#Python 2, 74 72 bytes

Having already been soundly beaten by @Flp.Tkc I'll just post my 74 72 byte recursive solution because it's different and it works and not because it will win (and also because I like recursive functions).

def f(a,b,c=1):
 print(c,"Shaggy")[c%b<1or`b`in`c`]
 if c<a:f(a,b,c+1)

Edit

-2 by removing the unneeded `` around the c in the print statement

From comments:

Call using

 f(a,b)

c will default to 1 due to the

 c=1

in the function definition and can then be incremented for the recursive function calls.

Python 2, 74 72 bytes

Having already been soundly beaten by @Flp.Tkc I'll just post my 74 72 byte recursive solution because it's different and it works and not because it will win (and also because I like recursive functions).

def f(a,b,c=1):
 print(c,"Shaggy")[c%b<1or`b`in`c`]
 if c<a:f(a,b,c+1)

Edit

-2 by removing the unneeded `` around the c in the print statement

From comments:

Call using

 f(a,b)

c will default to 1 due to the

 c=1

in the function definition and can then be incremented for the recursive function calls.

added 10 characters in body
Source Link
ElPedro
  • 6.5k
  • 2
  • 24
  • 38

#Python 2, 74 72 bytes

Having already been soundly beaten by @Flp.Tkc I'll just post my 7474 72 byte recursive solution because it's different and it works and not because it will win (and also because I like recursive functions).

def f(a,b,c=1):
 print(c,"Shaggy")[c%b<1or`b`in`c`]
 if c<a:f(a,b,c+1)

Edit

-2 by removing the unneeded `` around the c in the print statement

From comments:

Call using

 f(a,b)

c will default to 1 due to the

 c=1

in the function definition and can then be incremented for the recursive function calls.

#Python 2, 74 72 bytes

Having already been soundly beaten by @Flp.Tkc I'll just post my 74 byte recursive solution because it's different and it works and not because it will win (and also because I like recursive functions).

def f(a,b,c=1):
 print(c,"Shaggy")[c%b<1or`b`in`c`]
 if c<a:f(a,b,c+1)

Edit

-2 by removing the unneeded `` around the c in the print statement

From comments:

Call using

 f(a,b)

c will default to 1 due to the

 c=1

in the function definition and can then be incremented for the recursive function calls.

#Python 2, 74 72 bytes

Having already been soundly beaten by @Flp.Tkc I'll just post my 74 72 byte recursive solution because it's different and it works and not because it will win (and also because I like recursive functions).

def f(a,b,c=1):
 print(c,"Shaggy")[c%b<1or`b`in`c`]
 if c<a:f(a,b,c+1)

Edit

-2 by removing the unneeded `` around the c in the print statement

From comments:

Call using

 f(a,b)

c will default to 1 due to the

 c=1

in the function definition and can then be incremented for the recursive function calls.

added 92 characters in body
Source Link
ElPedro
  • 6.5k
  • 2
  • 24
  • 38

#Python 2, 7474 72 bytes

Having already been soundly beaten by @Flp.Tkc I'll just post my 74 byte recursive solution because it's different and it works and not because it will win (and also because I like recursive functions).

def f(a,b,c=1):
 print(`c`c,"Shaggy")[c%b<1or`b`in`c`]
 if c<a:f(a,b,c+1)

Edit

-2 by removing the unneeded `` around the c in the print statement

From comments:

Call using

 f(a,b)

c will default to 1 due to the

 c=1

in the function definition and can then be incremented for the recursive function calls.

#Python 2, 74 bytes

Having already been soundly beaten by @Flp.Tkc I'll just post my 74 byte recursive solution because it's different and it works and not because it will win (and also because I like recursive functions).

def f(a,b,c=1):
 print(`c`,"Shaggy")[c%b<1or`b`in`c`]
 if c<a:f(a,b,c+1)

From comments:

Call using

 f(a,b)

c will default to 1 due to the

 c=1

in the function definition and can then be incremented for the recursive function calls.

#Python 2, 74 72 bytes

Having already been soundly beaten by @Flp.Tkc I'll just post my 74 byte recursive solution because it's different and it works and not because it will win (and also because I like recursive functions).

def f(a,b,c=1):
 print(c,"Shaggy")[c%b<1or`b`in`c`]
 if c<a:f(a,b,c+1)

Edit

-2 by removing the unneeded `` around the c in the print statement

From comments:

Call using

 f(a,b)

c will default to 1 due to the

 c=1

in the function definition and can then be incremented for the recursive function calls.

added 190 characters in body
Source Link
ElPedro
  • 6.5k
  • 2
  • 24
  • 38
Loading
added 8 characters in body
Source Link
ElPedro
  • 6.5k
  • 2
  • 24
  • 38
Loading
added 16 characters in body
Source Link
ElPedro
  • 6.5k
  • 2
  • 24
  • 38
Loading
Source Link
ElPedro
  • 6.5k
  • 2
  • 24
  • 38
Loading