Open main menu

CDOT Wiki β

Changes

OPS445 Online Assignment 2

2 bytes removed, 00:46, 22 March 2022
m
Required Functions
== Required Functions ==
You will need to complete the functions inside the provided file called <code>duim.py</code>. The provided <code>checkA2CheckA2.py</code> will be used to test these functions.
* <code>call_du_sub()</code> should take the target directory as an argument and return a list of strings returned by the command <b>du -d 1<target directory></b>.
** Your list should <u>not</u> contain newline characters.
* <code>percent_to_graph()</code> should take two arguments: percent and the total chars. It should return a 'bar graph' as a string.
** Your function should check that the a percent argument is a valid number between 0 and 100. It should fail if it isn't. You can <code>raise ValueError</code> in this case.
** <b>total chars</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.
** The string returned by this function should only be composed of these two characters. For example, calling <code>percent_to_graph(50, 10)</code> should return:
572
edits