Skip to main content
Owning up to my failures
Source Link
DBADon
  • 151
  • 1
  • 5

Powershell (5.1), 2020 48* Bytes:

I setup my variables like this (which may not be correct):

|% $a = (7,13,9,2,10,2,4,10,7,13,4,9)

I then add that variable to:

$a |group|%{$m=@{}}{$m[$_.Name]=($_.CntCount)-eq2)}{$y$m}

OutputsThis outputs the "Name" and "True" or "False" (could also use the animals names & it would work)

To only list "True" or "False" it is 16 bytes:

|%{($_.Cnt-eq2)}
  • group - Groups the items
  • % - Abbreviation for For-Each
  • $m=@{} - Assigns the new variable
  • $_.Count-eq2 - Item count that equals 2
  • $y - List each item with True or False (if it equals 2)

Results are similar to this:

enter image description hereOutput

*Note: This answer has been edited as I bungled things the first multiple times...

Powershell (5.1), 20 Bytes:

|%{($_.Cnt-eq2)}{$y}

Outputs the "Name" and "True" or "False" (could also use the animals names & it would work)

To only list "True" or "False" it is 16 bytes:

|%{($_.Cnt-eq2)}
  • % - Abbreviation for For-Each
  • $_.Count-eq2 - Item count that equals 2
  • $y - List each item with True or False (if it equals 2)

Results are similar to this:

enter image description here

Powershell (5.1), 20 48* Bytes:

I setup my variables like this (which may not be correct):

 $a = (7,13,9,2,10,2,4,10,7,13,4,9)

I then add that variable to:

$a |group|%{$m=@{}}{$m[$_.Name]=($_.Count)-eq2}{$m}

This outputs the "Name" and "True" or "False" (could also use the animals names & it would work)

  • group - Groups the items
  • % - Abbreviation for For-Each
  • $m=@{} - Assigns the new variable
  • $_.Count-eq2 - Item count that equals 2
  • $y - List each item with True or False (if it equals 2)

Results are similar to this:

Output

*Note: This answer has been edited as I bungled things the first multiple times...

Changed Count to Cnt
Source Link
DBADon
  • 151
  • 1
  • 5

Powershell (5.1), 2220 Bytes:

|%{($_.CountCnt-eq2)}{$y}

Outputs the "Name" and "True" or "False" (could also use the animals names & it would work)

To only list "True" or "False" it is 1816 bytes:

|%{($_.CountCnt-eq2)}
  • % - Abbreviation for For-Each
  • $_.Count-eq2 - Item count that equals 2
  • $y - List each item with True or False (if it equals 2)

Results are similar to this:

enter image description here

Powershell (5.1), 22 Bytes:

|%{($_.Count-eq2)}{$y}

Outputs the "Name" and "True" or "False" (could also use the animals names & it would work)

To only list "True" or "False" it is 18 bytes:

|%{($_.Count-eq2)}
  • % - Abbreviation for For-Each
  • $_.Count-eq2 - Item count that equals 2
  • $y - List each item with True or False (if it equals 2)

Results are similar to this:

enter image description here

Powershell (5.1), 20 Bytes:

|%{($_.Cnt-eq2)}{$y}

Outputs the "Name" and "True" or "False" (could also use the animals names & it would work)

To only list "True" or "False" it is 16 bytes:

|%{($_.Cnt-eq2)}
  • % - Abbreviation for For-Each
  • $_.Count-eq2 - Item count that equals 2
  • $y - List each item with True or False (if it equals 2)

Results are similar to this:

enter image description here

added 121 characters in body
Source Link
DBADon
  • 151
  • 1
  • 5

Powershell (5.1), 22 Bytes:

|%{($_.Count-eq2)}{$y}

Outputs the "Name" and "True" or "False" (could also use the animals names & it would work)

To only list "True" or "False" it is 18 bytes:

|%{($_.Count-eq2)}
  • % - Abbreviation for For-Each
  • $_.Count-eq2 - Item count that equals 2
  • $y - List each item with True or False (if it equals 2)

Results are similar to this:

enter image description here

Powershell (5.1), 22 Bytes:

|%{($_.Count-eq2)}{$y}

Outputs the "Name" and "True" or "False" (could also use the animals names & it would work)

To only list "True" or "False" it is 18 bytes:

|%{($_.Count-eq2)}
  • % - Abbreviation for For-Each
  • $_.Count-eq2 - Item count that equals 2
  • $y - List each item with True or False (if it equals 2)

Powershell (5.1), 22 Bytes:

|%{($_.Count-eq2)}{$y}

Outputs the "Name" and "True" or "False" (could also use the animals names & it would work)

To only list "True" or "False" it is 18 bytes:

|%{($_.Count-eq2)}
  • % - Abbreviation for For-Each
  • $_.Count-eq2 - Item count that equals 2
  • $y - List each item with True or False (if it equals 2)

Results are similar to this:

enter image description here

Source Link
DBADon
  • 151
  • 1
  • 5
Loading