Basically a meme variation of FizzBuzz, but not exactly the same.
Write a program that outputs numbers between 1 and 1000 (inclusively). This is like a text board thread.
If it's dubs, instead of the number, print dubs. If trips, print trips. For trips, do NOT also output dubs. Only one or the other. If it's dubs or trips, do not include the number.
Notice that for 990, it doesn't output dubs, because it only counts for the last digits. And 999 only says trips, not dubs (even though it's also dubs, technically).
>>4 thanks, but tbh those are pretty basic FIOC golfing tricks: string multiplication instead of loop often saves you a lot of characters, py2 instead of 3 saves you one byte on print (one space instead of two parens) and the rest is just one-char variables and whitespace removal
Name:
Anonymous2018-05-24 11:51
>>5 But I thought the whole point of python was the forced whitespace.
Name:
Anonymous2018-05-24 12:10
>>6 no, it's (one word) Forced Indentation Of Code. other whitespaces are not significant
Name:
Anonymous2018-05-24 13:17
Compile with :gcc -include "stdio.h" dubs.c main(i){while(i<999)printf(i%10==i/10%10?i%10==i/100?"trips\n":"dubs\n":"%d\n",++i);}
Name:
Anonymous2018-05-24 13:30
>>8 Some explanation to what is going on for those who don't know C: 1.main defaults to int 2.(i) i defaults to int too, and renames first argument (int argc) 3.argc is 1 by default if no arguments are given.(first argument argv[0] is program name) 4.printf chooses one of three strings, "trips\n":"dubs\n":"%d\n", first two ignore the number (++i) since they lack the decimal output specifier "%d" which is used only if no conditions are met. 5.the condition ternary is left as exercise to the reader.
Write a program that outputs numbers between 1 and 1000 (inclusively). This is like a text board thread. If it's dubs, instead of the number, print dubs. If trips, print trips. For trips, do NOT also output dubs. Only one or the other. If it's dubs or trips, do not include the number.
Name:
Anonymous2018-05-25 7:06
this post should be recognized as dubs by your're are program