Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

/prog/ challenge 43: ❮«❝faggot quotes❞»❯

Name: Anonymous 2017-12-17 22:25

It is time for another challenge. This time you have to write a programme that will wrap its input in quotes, not necessarily only the ``faggot quotes''.

INPUT: A string in your language's native string type that can support all of the quotation marks characters (see bottom). If the native string is an ASCII string, another type may be used.
Input is read from stdin. Additionally a command line parameter may be specified. The argument is a positive integer preceded by
-
.

OUTPUT: The input string wrapped in n pairs of distinct quotation marks. A default of 3 is assumed should the parameter not be provided. The quotation marks are chosen randomly. You may use your language/s or system standard PRNG. If n > number of all possible quotation sets, use all of them.

EXAMPLES: (assuming the executable is named fq)
echo "anux" | fq
=>
«“‹anux›”»

echo "anux" | fq -1
=>
【anux】

echo "anux" | fq -1
=>
``anux''

echo "anux" | fq -0
=>
anux


CHARACTER LIST
One set per line, first the opening character then the closing
""
“”
‘’
‹›
«»
【】
❛❜
❝❞

There is also one special case where the items are multiple characters. The opening string is `` and the closing '' (known commonly as faggot quotes).

Good luck!

Name: Anonymous 2017-12-17 23:28

import faggotquotes

Name: Anonymous 2017-12-18 8:14

>>2
Ah yes, the classic python joke. I lolled good sir. Epic win.

Name: Anonymous 2017-12-18 9:50

py3:
a='"" “” ‘’ ‹› «» 【】 ❛❜ ❝❞'.split(' ');a.append(('``',"''"));b=input();from sys import argv as c;import random
for e in random.sample(a,min(c[1] if len(c)>1 else 3,len(a))):
b=e[0]+b+e[1]
print(b)

Name: Anonymous 2017-12-18 10:11

>>4
slightly shorter version:
a='"" “” ‘’ ‹› «» 【】 ❛❜ ❝❞'.split(' ')+[('``',"''")];b=input();from sys import argv as c;import random
for e in random.sample(a,min(c[1] if len(c)>1 else 3,len(a))):
b=e[0]+b+e[1]
print(b)

Name: Anonymous 2017-12-18 10:50

>>5
b=input();from sys import argv as c;import random
for e in random.sample('"" “” ‘’ ‹› «» 【】 ❛❜ ❝❞'.split(' ')+[('``',"''")],min(c[1] if len(c)>1 else 3,10)):
b=e[0]+b+e[1]
print(b)

Name: Anonymous 2017-12-18 14:19

>>4-6
I don't know python but this seems to expect the command line argument without the dash. Perhaps you can use abs() to easily extract the number since the dash is also a minus.

Name: Anonymous 2017-12-18 14:32

>>7
damn, this is actually completely wrong about cmdline parameter handling - not just because of minus but also because {sys.argv} is a list of strings, and python is strongly typed and won't convert it automatically

Name: Anonymous 2017-12-18 22:24

bamp pant

Name: Anonymous 2017-12-20 5:59

Working on it.

Name: Anonymous 2017-12-20 7:57

>>10
work on my dubs!

Name: Anonymous 2017-12-21 8:16

working on >>11-ku's dubbles

Name: Anonymous 2017-12-21 11:10

Ganbaruby.
def fq(s,t=3)%w[" " “ ” ‘ ’ ‹ › « » 【 】 ❛ ❜ ❝ ❞ `` ''].each_slice(2).to_a.shuffle[0..t-1].map{|b,a|s=b+s+a} if t>0;s end

Name: Anonymous 2017-12-21 11:41

>>13
I think you forgot to parse command line arguments

Name: Anonymous 2017-12-21 12:56

>>1
would echo "anux" | fq -2 => 【【anux】】 be correct output or should we make sure that each set of quotes is used only once?

Name: Anonymous 2017-12-21 15:02

>>15
OUTPUT: The input string wrapped in n pairs of distinct quotation marks

Name: Anonymous 2017-12-22 2:07

>>11-12
Back to 4chan, please.

Name: Anonymous 2017-12-22 7:26

>>17
no

Name: Anonymous 2017-12-22 10:00

>>14
I thought that wasn't required. Serves me right for not reading the OP more carefully.
s=STDIN.gets.chomp;t=-(ARGV[0]||-3).to_i;%w[" " “ ” ‘ ’ ‹ › « » 【 】 ❛ ❜ ❝ ❞ `` ''].each_slice(2).to_a.shuffle[0..t-1].map{|b,a|s=b+s+a} if t>0;puts s

Name: OP 2017-12-24 19:39

I am back home on January the 2nd so I will make it the deadline.

Name: Anonymous 2017-12-29 23:07

bump

Name: Anonymous 2017-12-30 0:28

More of this, please.

Name: Anonymous 2017-12-30 20:28

>>22
sweet dubs bro

Name: Anonymous 2017-12-30 21:32

>>23
Thank you.

Name: Anonymous 2017-12-30 23:43

>>23-24
Back to 4chan, please.

Name: Anonymous 2017-12-31 0:31

>>25
Can't. They banned me for checking others' dubs.

Name: Anonymous 2017-12-31 4:13

>>26
Good. Hopefully, you get banned from here too.

Name: Anonymous 2017-12-31 13:51

>>27
That's mean.

Don't change these.
Name: Email:
Entire Thread Thread List