This dear StackExchange site has so many challenges, and so many good answers. But what about the challenges that were never answered?


Write a program or a function that will print a pseudo-random open unanswered (as in, a question with exactly zero answers) challenge from PPCG. All possible challenges should be produced with the same probability.


  • No input will be taken.


  • Must only be the title, tags and the link which should be separated by newlines.
    • The title must be exactly like it is in the challenge.
    • The tags don't have a strict output format but must include all tags.
    • The link may or may not include the question-name after the question id and must lead to the challenge.
  • May or may not be translated to a human readable format.
    • & to &
  • Leading and trailing whitespace is allowed.


Encode a steganographic encoder into a package

Simple predictive keyboard CG


As this is , shortest answer in bytes wins.

  • 8
    \$\begingroup\$ I'm getting really sick of stack-exchange-api challenges. \$\endgroup\$
    – Riker
    Commented May 11, 2017 at 21:27
  • 3
    \$\begingroup\$ @Riker Uhm... thanks for your feedback? I really don't know why you would downvote for that reason but more power to you, I guess. \$\endgroup\$ Commented May 11, 2017 at 21:28
  • 6
    \$\begingroup\$ I didn't downvote for that. I downvoted because I think the question is boring. Also, would closed questions need to have the equal probability of being outputted? \$\endgroup\$
    – Riker
    Commented May 11, 2017 at 21:29
  • 1
    \$\begingroup\$ While I don't feel as strongly about it as @Riker, there does seem to have be a lot of API-related challenges lately; so much so that I managed to get myself blocked from using the API for ~21 hours! \$\endgroup\$
    – Shaggy
    Commented May 11, 2017 at 22:09
  • 4
    \$\begingroup\$ Interestingly enough, this challenge will show up during testing, but once I answer it, it won't show up in testing anymore. \$\endgroup\$
    – hyper-neutrino
    Commented May 11, 2017 at 22:45

3 Answers 3


JavaScript + HTML, 271 250 232 bytes

Apparantly you can use Dates as pseudo-random numbers. I stole this from Shaggy's answer.

(Only uses about 4 of your quota)

g=f=>fetch('//api.stackexchange.com/questions/unanswered?site=codegolf&page='+f).then(r=>r.json().then(j=>(q=[...q,...j.items])^j.has_more?g(f+1):document.write(`<pre>${(q=q[new Date%q.length]).title}

It makes an array q, then calls g(1), which fetches the first page of results and adds it to q. Then, if the request says it has_more, then it calls g(f+1), which fetches the next page, until it reaches the end and writes out to the HTML document (Which will automatically unescape the response)

If we don't care about all of the unanswered questions, just the most recent 30 (Only uses 1 of your quota):

JavaScript + HTML, 213 196 179 bytes

fetch`//api.stackexchange.com/questions/unanswered?site=codegolf`.then(r=>r.json().then(j=>document.write(`<pre>${(j=j.items[new Date%j.items.length]).title}

  • \$\begingroup\$ Sorry, @Artyer, I was so focused on working on my own answer, I never spotted that you'd beaten me to the punch by a few minutes. I'm happy to delete my answer, if you feel it's to similar to yours. \$\endgroup\$
    – Shaggy
    Commented May 12, 2017 at 9:17
  • \$\begingroup\$ @Shaggy It's alright. I also wrote the second answer at the same time as you wrote your answer, so it's a happy coincidence that they ended up similar. \$\endgroup\$
    – Artyer
    Commented May 12, 2017 at 9:18
  • \$\begingroup\$ You could save a few byes by hardcoding in the number of pages that need to be fetched. Instead of j.has_more?g(f+1), try ++f<5?g(f) \$\endgroup\$
    – Shaggy
    Commented May 12, 2017 at 10:38
  • \$\begingroup\$ You could also replace q=q.concat(j.items) with q=[...q,...j.items]. It looks like Tags: is optional, so you can drop that too. And no need to join q.tags, it will be coerced into a string when being concatenated to a string. Finally, using a template literal for the final should save you a few bytes, too. \$\endgroup\$
    – Shaggy
    Commented May 12, 2017 at 10:45
  • \$\begingroup\$ @Shaggy Unfortunately, I've met my quota. It resets in 425 seconds though. \$\endgroup\$
    – Artyer
    Commented May 12, 2017 at 10:53

Python + requests + json + random + html, 249 239 bytes

import requests as r,json,random as R,html
print('\n'.join([html.unescape(j['title']),'Tags: '+', '.join(j['tags']),j['link']]))

Turned out longer than I'd like.

-10 bytes thanks to @totallyhuman by using R.choice rather than R.shuffle and taking the first element.

  • \$\begingroup\$ Can you save a few bytes by using random.shuffle? \$\endgroup\$ Commented May 12, 2017 at 1:00
  • \$\begingroup\$ ...Wait, or even better, random.choice()? \$\endgroup\$ Commented May 12, 2017 at 1:25
  • 1
    \$\begingroup\$ @totallyhuman Changing the inpurt name happens to actually make no difference in bytecount :P But thanks for .choice()! \$\endgroup\$
    – hyper-neutrino
    Commented May 12, 2017 at 1:33
  • \$\begingroup\$ You don't need the json library, use r.get(url).json() instead \$\endgroup\$
    – ovs
    Commented May 12, 2017 at 5:40
  • \$\begingroup\$ This doesn't account for has_more. It only randomly chooses from the first 30. \$\endgroup\$
    – Artyer
    Commented May 12, 2017 at 8:40

Bash 255 232 bytes

a="api.stackexchange.com/questions/";b="?site=codegolf";c=$(w3m $a"unanswered"$b"&filter=total"|tr -cd 0-9);w3m $a"no-answers"$b"&pagesize=1&page="$((RANDOM%c))|jq -r ".items[0]|.title,(.tags|join(\", \")),.link"|recode html..utf-8

Looks like a wrong results returns for totals for no-answers/unanswered. General idea - get total, than get random page with one item.

Bash 174 153 bytes

w3m api.stackexchange.com/questions/no-answers?site=codegolf|jq -r ".items[$RANDOM%(.items|length)]|.title,(.tags|join(\", \")),.link"|recode html..utf-8

It select one random question from last 30, not from all questions. Works from command line. Required curl w3m, jq and recode.


Tips for golfing in Charcoal
code-golf, tips
  • \$\begingroup\$ I'm pretty sure you need to choose from all of them. But welcome to PPCG anyway! \$\endgroup\$ Commented May 12, 2017 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.