In trying to learn Python, I'm reading through How to Think Like a Computer 
Scientist. I'm just on the third chapter but I'm getting stuck on this question:

Fill in the body of the function definition for cat_n_times so that it will 
print the string, s, n times:

def cat_n_times(s, n):
    <fill in your code here>
Save this function in a script named import_test.py. Now at a unix prompt, make 
sure you are in the same directory where the import_test.py is located ( ls 
should show import_test.py). Start a Python shell and try the following:

>>> from import_test import *
>>> cat_n_times('Spam', 7)
SpamSpamSpamSpamSpamSpamSpam
If all is well, your session should work the same as this one. Experiment with 
other calls to cat_n_times until you feel comfortable with how it works.

I'm thinking it should be pretty easy but, again, I'm a beginner.
I copied the whole question but basically I just need some help with what the 
script should look like, that'd be great.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to