11.11) Exercise 33 - File Name Generator
Do the File Name Generator exercise if you haven’t done it yet.
- Turn the program into a function with:
Arguments:
- number: id of sample
- location : sample location
- date : date of sampling
Return value:
- A string containing the name of the file which will contain the data
Example of usage:
>>> filename=filenamegen(1, ‘Ilkley’, ’10oct2013’) >>> print filename Sample_Ilkley_10oct2013_site1.dat
- Make the arguments location and date optional. If no value for location and date is provided, return the value ‘Sample_sitenumber.dat’ where number is the sample id.
>>> filename=filenamegen(23) >>> print filename Sample_site23.dat
Solution: filename_generator_function.py