fork(3) download
  1. def repeat(s, exclaim):
  2. """Returns the string s repeated 3 times.
  3. If exclaim is true, add exclamation marks.
  4. """
  5.  
  6. result = s + s + s # can also use "s * 3" which is faster (Why?)
  7. if exclaim:
  8. result = result + '!!!'
  9. return result
  10.  
  11. def main():
  12. print repeat ('Yay', False) ## YayYayYay
  13. print repeat ('Woo Hoo', True) ## Woo HooWoo HooWoo Hoo!!!
Runtime error #stdin #stdout 0.02s 5760KB
stdin
Standard input is empty
stdout
Standard output is empty