g | x | w | all
Bytes Lang Time Link
015Perl 5 plF250521T155156ZXcali
012APLDyalog Unicode250521T154504ZMat_rdv
040AWK250521T151052Zxrs
006Thunno 2230813T104404ZThe Thon
024International Phonetic Esoteric Language190930T193302Zbigyihsu
007Stax190930T223056Zrecursiv
008Japt190930T164206ZShaggy
024Mathematica170131T092511ZGreg Mar
042R170130T161016Zrturnbul
nanCommon Lisp170131T102336Zcoredump
016Jellyfish170202T150431ZZgarb
037Haskell170202T144651ZLaikoni
043C++14170202T133657ZKarl Nap
068Clojure170202T033851Zshadowta
059GNU AWK170202T032228Zshadowta
008Pyth170131T082630ZSteven H
102PostgreSQL170201T073236ZHarun
029Perl 5170131T004458Znwellnho
025Ruby170131T174739ZRoberto
067C# Interactive170130T163729ZPontus M
092SimpleTemplate170131T115202ZIsmael M
040Clojure170131T104828Zcliffroo
039Rebol170131T093031Zdraegtun
027Groovy170131T091008ZWireless
050PHP170131T021338ZTitus
017sB~170131T000352Z12Me21
045Bash + coreutils170130T193112ZMitchell
033TIBasic170130T175036ZTimtech
008MATL170130T172332ZSuever
017Gol><> Golfish170130T173829ZNick Mat
009Pyth170130T162133ZLevitati
029SmileBASIC170130T152506Z12Me21
030Python170130T153717ZLevitati
033PowerShell170130T154032Zbriantis
029Python 2170130T153836ZDennis
030JavaScript ES6170130T151808ZTom
021Perl 6170130T152932Zsmls
009CJam170130T152155ZMartin E
007Jelly170130T152821ZJonathan
00805AB1E170130T152356ZMagic Oc

Perl 5 -plF, 15 bytes

$_.=')'x(@F*<>)

Try it online!

APL(Dyalog Unicode), 12 bytes SBCS

⊢,⌊⍤×∘≢⍴')'⍨

Try it on APLgolf!

This function takes a ratio as left argument and a message as right argument. Number of ) is rounded down.

Explanation

        ')'⍨   ⍝ Constant function returning )
       ⍴       ⍝ Reshape (repeat)
      ≢        ⍝ Tally
     ∘         ⍝ Preprocess right
    ×          ⍝ Multiply
   ⍤           ⍝ Postprocess
  ⌊            ⍝ Round down
  ⌊⍤×∘≢        ⍝ Multiply the ratio by the length of the message and round it down
 ,             ⍝ Concatenate
⊢             ⍝ Right argument

ratio (⊢,⌊⍤×∘≢⍴')'⍨) message ←→ message , (ratio ⌊⍤×∘≢ message) ⍴ ')'

AWK, 40 bytes

{for(s=$1;++i<length($1)*$2;)s=s")"}$0=s

Attempt This Online!

Takes input as string, decimal

Thunno 2, 6 bytes

l×')×+

Try it online!

Takes the string, then the decimal.

Explanation

l×')×+  '# Implicit input
l        # Length of string input
 ×       # Multiply by the number
  ')×   '# Multiply by ")"
         # (implicit floor)
     +   # Append to the input
         # Implicit output

International Phonetic Esoteric Language, 24 bytes

A reimplementation of the old answer into the new specification. Input is as a positive integer first, then the string.

ɪ{100}viħɖf0ɑ")"x1esøɒʕo

Explanation:

ɪ{100}viħɖf0ɑ")"x1esøɒʕo
ɪ                        (push input int)
 {100}                   (push 100)
      v                  (divide int//100)
       iħ                (push input str, push len)
         ɖ               (rotate top 3 clockwise)
          f              (multiply int//100 * len)
           0             (push 0)
            ɑ            (begin loop, from 0 to int//100 * len)
             ")"         (push ")")
                x        (concat)
                 1esø    (increment index)
                     ɒ   (end loop)
                      ʕ  (list to str)
                       o (print)

International Phonetic Esoteric Language, 18 bytes (WIP language) (OLD)

I discovered some bugs in my interpreter because of this challenge. Takes input as string then integer.

iɢ291tʃɪðθœ<)>ɲqɶo

No TIO interpreter yet, but is runnable by cloning the repository above, and calling python3 main.py "code here".

iɢ291tʃɪðθœ<)>ɲqɶo
i                  ; push string input
 ɢ                 ; peek, push string length
  291tʃ            ; push (1 + 9)^2
       ɪ           ; push number input
        ðθ         ; push [num / 100 * len]
          œ        ; start loop: pop, run ceil(n) times
           <)>     ; push string ")"
              ɲ    ; swap top 2 elements of the stack
               q   ; pop, pop, push concatenated strings
                ɶ  ; end loop
                 o ; output

Sample cases:

python3 main.py "iɢ291tʃɪðθœ<)>ɲqɶo"
codegolf
125
codegolf))))))))))

python3 main.py "iɢ291tʃɪðθœ<)>ɲqɶo"
iɢ291tʃɪðθœ<)>ɲqɶo
300
iɢ291tʃɪðθœ<)>ɲqɶo))))))))))))))))))))))))))))))))))))))))))))))))))))))

python3 main.py "iɢ291tʃɪðθœ<)>ɲqɶo"
less than 1.00
50
less than 1.00)))))))

Stax, 7 bytes

é┴eó¡µf

Run and debug it

Japt, 8 bytes

+')pUÊ*V

Try it

Mathematica, 24 bytes

#<>Table[")",#2Tr[1^#]]&

Unnamed function taking a list of characters and a decimal number as input and returning a string. Tr[1^#] is a sneaky golfy way to calculate the length of a list, so #2Tr[1^#] computes the required number of parentheses. Table[")",...] produces a list of that many right parentheses (all decimals automatically rounded down, which is nice). Finally, #<> concatenates the input string to the parentheses, flattening the list produced by Table as it goes.

R, 62 46 42 bytes

Anonymous function that takes string a and decimal n, prints output to stdout.

pryr::f(cat(a,rep(")",n*nchar(a)),sep=""))

Common Lisp, 59 52 50

Parentheses? I am in.

(lambda(s n)(format()"~a~v@{)~}"s(*(length s)n)0))

Details

(lambda(s n)               ; two arguments (string and ratio)
  (format ()               ; format as string
          "~a~v@{)~}"      ; control string (see below)
          s                ; first argument (string)
          (* (length s) n) ; second argument (number of parens)
          0))              ; one more element, the value does not matter

Format control string

Since no element in the list is consumed by the format, the loop is infinite but fortunately, it is also bounded by V, a.k.a. the number of parentheses to be printed.


Edit: thanks to Michael Vehrs for pointing out that there is no need to round the numerical argument (the question allows to truncate/round however we want, so the default behavior works here).

Jellyfish, 16 bytes

P
,$')
 *i
 #
EI

Takes input as decimal, then newline, then string. Try it online!

Explanation

Let's start from the bottom.

I

A raw string read from STDIN.

#
I

The length of the string.

*i
#
I

Multiply it by a number read from STDIN (the number is read first, since i comes before I in the source).

$')
*i
#
I

Repeat the character ) that many times, rounding down.

,$')
 *i
 #
EI

Append to the original string (the , looks for arguments from the south and east, and E tells the southward seeker to turn east, where it finds the I).

P
,$')
 *i
 #
EI

Print the resulting string.

Haskell, 37 bytes

s!n=s++([1..div(n*length s)100]>>")")

Try it online! Usage: "codegolf" ! 125


A version that takes a decimal number: (41 bytes)

s!n=s++([1..n*toRational(length s)]>>")")

Try it online! Usage: "codegolf" ! 1.25

C++14, 43 bytes

As unnamed lambda modifying its input, assuming s is similar to std::string (has .append(int,char) and assuming p to be of floating point type:

[](auto&s,auto p){s.append(s.size()*p,41);}

Usage:

#include<string>
#include<iostream>

auto f=
[](auto&s,auto p){s.append(s.size()*p,41);}
;


int main() {
 std::string s = "abcdefghijk";
 f(s,0.75);
 std::cout << s << std::endl;
}

Clojure, 68 bytes

An anonymous function that accepts decimal input.

(fn [s n] (print (str s (reduce str (repeat (* n (count s)) ")")))))

Literally the first Lisp program I've ever written! I'm already having fun.

GNU AWK, 59 bytes

{t=sprintf("%"n*length(s)"s","");gsub(/ /,")",t);print s t}

Accepts arguments on command line (using the decimal form) like so:

: | awk -v s="codegolf" -v n=0.75 -f russianify.awk

Yes, AWK requires something to be attached to stdin, even if that something is 0 bytes returned by the no-op shell builtin. You could also use echo | awk ..., or really anything that doesn't contain a newline.

Pyth, 8 bytes

*\)s*lpz

Online Test! Takes the excitement ratio first, then the string to be enthused about.

Explanation:

      pz  print out the enthused string
     l    ... and get its length
    *...Q multiply that by the ratio
   s      floor to get an integer, let's call this S
 \)       single-character string ")"
* ")" S   multiply that integer by the string, which gives a string of )s of length S.
          implicitly print that string of S )s.

PostgreSQL, 102 bytes

create function q(text,int)returns text as $$select rpad($1,(100+$2)*length($1)/100,')')$$language sql

Details

Uses the integer input format.

This simply right-pads the input string with parens out to the target length.

create function q(text,int)
returns text as $$
    select rpad($1,             -- Pad the string input
        (100 + $2) *            -- to 100 + int input % ...
        length($1) / 100,       -- ...of the input string
        ')')                    -- with ) characters
$$ language sql

Called with

select q('codegolf', 125), q('codegolf', 75);
select q('noob team omg', 50), q('hi!', 499);

Perl 5, 29 bytes

sub{($_=pop).')'x(y///c*pop)}

(Number is first arg, string is second.)

Try it online!

Ruby, 25 bytes

->(s,n){s+')'*(s.size*n)}

I'm using lambdas. The test program would be something like:

f=->(s,n){s+')'*(s.size*n)}
f.("codegolf", 1.5)        # => "codegolf))))))))))))"
f.("hi!", 4.99)            # => "hi!))))))))))))))"

C# Interactive, 77 67 bytes

string r(string s,int p)=>s+new string(')',(int)(s.Length*p/100d));

C# interactive is sweet.

SimpleTemplate, 92 bytes

Takes the string as the first parameter and the "ratio" as the second.
The ratio is between 0 and 5, with 2 decimal places.

{@echoargv.0}{@callstrlen intoL argv.0}{@set*Y argv.1,L}{@callstr_repeat intoO")",Y}{@echoO}

As you can see, it is non-optimal.
The 2 {echo} there could be reduced to 1.
Due to a bug in the compiler, this code can't be reduced much further.


Ungolfed:

{@echo argv.0}
{@call strlen into length argv.0}
{@set* ratio argv.1, length}
{@call str_repeat into parenthesis ")", ratio}
{@echo parenthesis}

If no bug existed, the code would look like this, 86 bytes:

{@callstrlen intoL argv.0}{@set*Y argv.1,L}{@callstr_repeat intoO")",Y}{@echoargv.0,O}

Clojure, 40 bytes

Quite boring solution :

#(reduce str %(repeat(*(count %)%2)")"))

Just reduces str function on a list of closing parentheses with a string as initial parameter.

See it online : https://ideone.com/5jEgWS

Not-so-boring solution (64 bytes) :

#(.replace(str(nth(iterate list(symbol %))(*(count %)%2)))"(""")

Converts input string to a symbol (to get rid of quotes) and repeatedly applies function list on it generating infinite sequence like this: (a (a) ((a)) (((a))) ... ). Takes nth element converts it to string and replaces all opening parentheses with nothing.

See it online : https://ideone.com/C8JmaU

Rebol, 39 bytes

func[a b][append/dup a")"b * length? a]

Groovy, 27 bytes

Straightforward solution

{s,r->s+')'*(s.length()*r)}

Test program :

def f = {s,r->s+')'*(s.length()*r)}

println f("hi!", 4.99)
println f("noob team omg", 0.5)

PHP, 50 bytes

<?=str_pad($s=$argv[1],strlen($s)*++$argv[2],")");

takes string and decimal number as command line arguments; cuts padding. Run with -r;

breakdown

<?=                     // print ...
str_pad(                    // pad
    $s=$argv[1],            // string=argument 1
    strlen($s)*++$argv[2],  // to string length*(1+argument 2) 
    ")"                     // using ")" as padding string
);

sB~, 17 bytes

i\,N?\;')'*(N*l(\

Explained:

i\,N    input a string and a number
?\;     print the string
')'*    also print ) multiplied by...
(N*l(\  the number times the string length.

Parentheses are closed automatically

Here's the output of the compiler, if you're interested:

 INPUT  S$ ,N? S$ ;")"*(N* LEN(  S$ ))

This version of the compiler was written on 1/27/2017 at 11:12 pm, which might have been a few minutes after this question was posted. So here's a version which works on the oldest version of the compiler, written an hour earlier: iS$,N?S$;')'*(N*l(S$)) (22 bytes)

Bash + coreutils, 45 bytes

echo $1`seq -s\) $[${#1}*$2/100+1]|tr -cd \)`

Try it online!

Integer input.

TI-Basic, 33 bytes

Takes decimal input.

Prompt Str1,A
")
For(I,0,9
Ans+Ans
End
Str1+sub(Ans,1,AI

MATL, 11 10 8 bytes

yn*:"41h

This solution uses the decimal form of the second input

Try it online!

Explanation

        % Implicitly grab first input as a string
        % Implicitly grab the second input as a number
y       % Make a copy of the first input
n       % Compute the length of the string
*       % Multiply the decimal by the length to determine the # of )'s (N)
:       % Create the array [1...N]
"       % For each element in this array
  41    % Push 41 to the stack (ACSII for ")")
  h     % Horizontally concatenate this with the current string
        % Implicit end of for loop and display

Gol><> (Golfish), 17 bytes

i:a=?v
R*Il~/Hr)`

Try it here.

The top line reads characters (i) until it finds a newline (ASCII 10, a), then goes down (v).

Then we discard one character (the newline) with ~, push the length of the stack (l), read a float (I), multiply the two, and repeatedly (R) push the character ")" that many times. Finally, reverse the stack (r), output it and halt (H).

Pyth, 9 bytes

*s*lpzE")

Takes two lines of input: string and ratio (decimal).

Try it on pyth.herokuapp.com

Explanation

A denotes a function's first argument, B its second argument.

*s*lpzE")
    pz     # print the input string
   lAA     # take the length of the printed string
      E    # read the next line of input (the emphasis ratio)
  *AAAB    # multiply the length by the ratio
 sAAAAA    # floor the result
*AAAAAA")  # repeat ")" n times
           # implicit print

SmileBASIC, 29 bytes

INPUT S$,N?S$;")"*(LEN(S$)*N)

Python, 30 bytes

lambda s,r:s+')'*int(len(s)*r)

Uses the decimal input.

Try it online!

PowerShell, 33 bytes

$a,$b=$args;$a+')'*($b*$a.Length)

Try it online!

Supports decimal format.

Python 2, 29 bytes

lambda s,p:s+len(s)*p/100*')'

s in the string, p is the percentage (integer).

Try it online!

JavaScript ES6, 38 31 30 bytes

s=>n=>s+')'.repeat(s.length*n)

f=s=>n=>s+')'.repeat(s.length*n)

console.log(f("hi!")(4.99))

Perl 6, 21 bytes

{$^a~")"x$^b*$a.comb}

CJam, 9 bytes

l_,ld*')*

Try it online!

Input string on the first line, emphasis ratio in range 0 to 5 on the second.

Explanation

l    e# Read input string.
_,   e# Duplicate, get length.
ld   e# Read emphasis ratio.
*    e# Multiply by length.
')*  e# Get that many parentheses.

Jelly, 7 bytes

ȮL×Ċ”)x

Try it online!

Uses the decimal format.

How?

ȮL×Ċ”)x - Main link: string, decimal
Ȯ       - print string
 L      - length(string)
  ×     - multiply by the decimal
   Ċ    - ceiling (since rounding method is flexible)
    ”)  - a ')' character
      x - repeated that many times
        - implicit print

05AB1E, 9 8 bytes

g*ï')×¹ì

Try it online!

g*       # Length, multiplied by emphasis.
  ï')×   # Covnerted to an integer, push that many parenthesis.
      ¹ì # Prepend original string.

Works for both integer and decimal, arguments order: f(String, Double)