Repeat a string: Difference between revisions

Line 1,797:
def repeat(s, times):
return s * times</lang>
 
=={{header|Python}}==
<lang python>def repeat(s, times):
return s * times
 
print(repeat("ha", 5))</lang>
# output:
# hahahahaha
 
=== Using Lambda ===
<lang python>x = lambda a: a * 5
print(x("ha"))</lang>
{{Out}}
<pre>hahahahaha</pre>
 
=={{header|Prolog}}==