[Tutor] saving output in a text file
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Sat Jul 1 00:04:41 CEST 2006
> def double(s):
> "double: string -> string
> doubles up the input string s."
> return s + s
Gaah. Typos. My apologies. Here's a correction to double()
def double(s):
"""double: string -> string
Doubles up the input string s. For example, double("abc")
should return "abcabc".
"""
return s + s
> Would you be able to write a program that takes "hello world", runs it
> through double(), and writes out "hello worldhelloworld" to disk?
I meant to say that the expected content of the file should be:
"hello worldhello world"
My apologies; I rushed that message too quickly.
More information about the Tutor
mailing list