Python2 (63)
Corrected version of @idiot.py's code (I don't have enough reputation to comment on his post).
print[n if n%3and'3'not in str(n)else"bzzt"for n in range(501)]
or, equivalently,
print["bzzt"if not n%3or'3'in str(n)else n for n in range(501)]
You have to negate the second condition, otherwise it gives incorrect output.
output:
['bzzt', 1, 2, 'bzzt', 4, 5, 'bzzt', 7, 8, 'bzzt', 10, 11, 'bzzt', 'bzzt', 14, 'bzzt', 16, 17, 'bzzt', 19, 20, 'bzzt', 22, 'bzzt', 'bzzt', 25, 26, 'bzzt', 28, 29, 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 40, 41, 'bzzt', 'bzzt', 44, 'bzzt', 46, 47, 'bzzt', 49, 50, 'bzzt', 52, 'bzzt', 'bzzt', 55, 56, 'bzzt', 58, 59, 'bzzt', 61, 62, 'bzzt', 64, 65, 'bzzt', 67, 68, 'bzzt', 70, 71, 'bzzt', 'bzzt', 74, 'bzzt', 76, 77, 'bzzt', 79, 80, 'bzzt', 82, 'bzzt', 'bzzt', 85, 86, 'bzzt', 88, 89, 'bzzt', 91, 92, 'bzzt', 94, 95, 'bzzt', 97, 98, 'bzzt', 100, 101, 'bzzt', 'bzzt', 104, 'bzzt', 106, 107, 'bzzt', 109, 110, 'bzzt', 112, 'bzzt', 'bzzt', 115, 116, 'bzzt', 118, 119, 'bzzt', 121, 122, 'bzzt', 124, 125, 'bzzt', 127, 128, 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 140, 'bzzt', 142, 'bzzt', 'bzzt', 145, 146, 'bzzt', 148, 149, 'bzzt', 151, 152, 'bzzt', 154, 155, 'bzzt', 157, 158, 'bzzt', 160, 161, 'bzzt', 'bzzt', 164, 'bzzt', 166, 167, 'bzzt', 169, 170, 'bzzt', 172, 'bzzt', 'bzzt', 175, 176, 'bzzt', 178, 179, 'bzzt', 181, 182, 'bzzt', 184, 185, 'bzzt', 187, 188, 'bzzt', 190, 191, 'bzzt', 'bzzt', 194, 'bzzt', 196, 197, 'bzzt', 199, 200, 'bzzt', 202, 'bzzt', 'bzzt', 205, 206, 'bzzt', 208, 209, 'bzzt', 211, 212, 'bzzt', 214, 215, 'bzzt', 217, 218, 'bzzt', 220, 221, 'bzzt', 'bzzt', 224, 'bzzt', 226, 227, 'bzzt', 229, 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 241, 242, 'bzzt', 244, 245, 'bzzt', 247, 248, 'bzzt', 250, 251, 'bzzt', 'bzzt', 254, 'bzzt', 256, 257, 'bzzt', 259, 260, 'bzzt', 262, 'bzzt', 'bzzt', 265, 266, 'bzzt', 268, 269, 'bzzt', 271, 272, 'bzzt', 274, 275, 'bzzt', 277, 278, 'bzzt', 280, 281, 'bzzt', 'bzzt', 284, 'bzzt', 286, 287, 'bzzt', 289, 290, 'bzzt', 292, 'bzzt', 'bzzt', 295, 296, 'bzzt', 298, 299, 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 400, 401, 'bzzt', 'bzzt', 404, 'bzzt', 406, 407, 'bzzt', 409, 410, 'bzzt', 412, 'bzzt', 'bzzt', 415, 416, 'bzzt', 418, 419, 'bzzt', 421, 422, 'bzzt', 424, 425, 'bzzt', 427, 428, 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 440, 'bzzt', 442, 'bzzt', 'bzzt', 445, 446, 'bzzt', 448, 449, 'bzzt', 451, 452, 'bzzt', 454, 455, 'bzzt', 457, 458, 'bzzt', 460, 461, 'bzzt', 'bzzt', 464, 'bzzt', 466, 467, 'bzzt', 469, 470, 'bzzt', 472, 'bzzt', 'bzzt', 475, 476, 'bzzt', 478, 479, 'bzzt', 481, 482, 'bzzt', 484, 485, 'bzzt', 487, 488, 'bzzt', 490, 491, 'bzzt', 'bzzt', 494, 'bzzt', 496, 497, 'bzzt', 499, 500]
"whopping" means "exceptionally large or great" - exactly the opposite of this intended meaning! maybe replace with "astounding" or an antonym: "diminutive", "minuscule", or perhaps "whoppingly small" – Claudiu – 2014-12-19T07:09:55.420
You can output the numbers one at a time (ex, output 1, then 2, then bzzt, then 4, etc) or all at once (ex, output 1 2 bzzt 4 5)
Do you mean "you can output the number one on each line or all on one line - either way is fine"? – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ – 2014-06-23T07:02:13.910Yes, that's exactly what I mean. – Jon – 2014-06-23T07:04:54.387
1For purposes of this question, is 0 divisible by 3? – Οurous – 2014-06-23T07:07:07.090
Also, 3 should be printed as a number not as bzzt.. This meets both requirements, contains 3 and divisible by 3. – Teun Pronk – 2014-06-23T07:11:11.037
@Ourous either. – Jon – 2014-06-23T07:12:24.003
@TeunPronk See point two. – Jon – 2014-06-23T07:13:06.180
@Chipperyman you say 30 should be printed right? It seems to say that. if thats the case 3 should be printed too and so does 33 and so on. – Teun Pronk – 2014-06-23T07:14:17.240
@TeunPronk By that I meant that 30 would count as buzz. I edited the question to be more clear. – Jon – 2014-06-23T07:16:03.873
@Chipperyman fair enough. – Teun Pronk – 2014-06-23T07:16:17.520
There's a similar question here.
– grc – 2014-06-23T08:01:46.993Similar but not a dupe. – Jon – 2014-06-23T08:10:38.480
Is a seperator required or is
12bzzt4
ok? – Martijn – 2014-06-23T08:34:24.0472Is it "buzz" or "bzzt"? You wrote "buzz" twice so far. – aditsu quit because SE is EVIL – 2014-06-23T08:40:37.627
General question for CG, I've got an answer in two languages, do I make two posts or combine them in 1? – Martijn – 2014-06-23T08:42:15.687
@Martijn Two posts, unless they're very similar answers. – grc – 2014-06-23T08:51:19.343
They are very similar, same logic, but language specific functions. – Martijn – 2014-06-23T08:55:26.253
3Please clarify. Do I have to output
buzz
orbzzt
if both of the requirements apply? Do I have to output12bzzt4
orbzzt
for1234
? – nyuszika7h – 2014-06-23T12:41:45.7174I'd say
bzzt
for1234
. It's a 'common' drinking game here (only we often do it with 7) – Martijn – 2014-06-23T13:38:33.327@Martijn 3 is more drinking :) – Cruncher – 2014-06-23T14:41:11.210
66"0 can be divisible by 3 or not divisible. You can choose." I really don't think you can choose. 0 mod 3 is 0, that's not really a matter of opinion. – David Conrad – 2014-06-23T15:54:06.000
Rule 2 seems to suggest that we only have to check one of the cases. Please clarify. – nyuszika7h – 2014-06-25T15:51:38.923
@nyuszika7h That is correct. – Jon – 2014-06-25T19:19:24.537
@Chipperyman Thanks, that means many of us can make our solutions shorter. – nyuszika7h – 2014-06-25T19:20:08.247
1@nyuszika7h Wait I think I misunderstood you. Each number only needs to meet one requirement. You have to check both – Jon – 2014-06-25T19:20:50.483
@Chipperyman Ah, that's what I thought. – nyuszika7h – 2014-06-25T19:21:38.350
I like this level of games. Not to easy, not to mathematical :) – Martijn – 2014-06-26T07:06:56.050
@Chipperyman: I think it is clearer to say that it is sufficient to produce one 'bzzt' even if both requirements are met. – sigma – 2014-06-26T11:55:05.787
1@Chipperyman Clarification required of last requirement 313 should the output be Bzzt or Bzzt1Bzzt ? – Adam Speight – 2014-06-26T13:41:51.577
@AdamSpeight Bzzt is what all the other answers have. – Οurous – 2014-06-26T21:28:39.670
@nyuszika7h You shouldn't output either 12bzzt4 or bzzt for 1234, because you should have stopped at 500. – Chris Cudmore – 2014-06-26T21:52:10.330
@ChrisCudmore That was just an example, duh. – nyuszika7h – 2014-06-26T21:52:52.100
1The question has a bug too. "Some type of separator is mandatory (12bzzt14 doesn't count)" The output there should have been bzzt bzzt 14. – Paul – 2014-06-27T22:03:22.800
I thought "Can't hardcode the numbers" implied you can't use the number 3 in the code. What did I miss? – Henk Langeveld – 2014-06-29T09:17:58.273
Means you can't make a table of { "3", "6", "9", "12", "13" }, etc. – Jon – 2014-06-29T17:35:22.780
Also, my code (...)*100000. Is there any problem with that? According to the logs, this doesn't work. Why? – proud haskeller – 2014-08-23T19:46:11.403