Changes

Jump to: navigation, search

OPS435 Python/assignment 1 fall2022

3 bytes added, 13:10, 24 September 2022
Required Functions
** '-d 1' specifies a <i>max depth</i> of 1. Your list shouldn't include files, just a list of subdirectories in the target directory.
** Your list should <u>not</u> contain newline characters.
 
2. <code>percent_to_graph()</code> should take two arguments: percent and the total chars. It should return a 'bar graph' as a string.
** <b>max_length</b> refers to the total number of characters that the bar graph will be composed of. You can use equal signs <code>=</code> or any other character that makes sense, but the empty space <b>must be composed of spaces</b>, at least until you have passed the first milestone.
'===== '
<b>Please note that the '' characters should <u>not</u> be part of the output, they are here to indicate that this is a string!</b>
 
3. <code>create_dir_dict</code> should take a list as the argument, and should return a dictionary.
** The list can be the list returned by <code>call_du_sub()</code>.
** The dictionary that you return should have the full directory name as <i>key</i>, and the number of bytes in the directory as the <i>value</i>. This value should be an integer. For example, using the example of <b>/usr/local/lib</b>, the function would return:
{'/usr/local/lib/heroku': 164028, '/usr/local/lib/python2.7': 11072, ...}
 
4. <code>get_max</code> should take a dictionary and the target directory as arguments, and it should return the total size of the target directory as an integer.
** The dictionary returned by <code>create_dir_dict</code> will be used for this function. When calculating the percentage for each subdirectory, you will need the total size of the target directory as the denominator. This function will return that value.

Navigation menu