Open main menu

CDOT Wiki β

Changes

OPS435 Assignment 1 for Section C

309 bytes added, 13:42, 1 February 2021
Required Functions
== Required Functions ==
You will need to complete the functions inside the provided file called <code>assignment1duim.py</code>. The provided <code>checkA1.py</code> will be used to test these functions.
* <code>call_dfcall_du_sub()</code> should take no arguments the target directory as an argument and return a list of strings returned by the shell command<b>du -d 1<target directory></b>. * Use subprocess.Popen. * '-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. * <code>call_freepercent_to_graph()</code> should take no two arguments, : percent and the total chars. It should return a list of strings from the shell'bar graph' as a string.
* <code>call_hostname()</code> and <code>call_uptime()</code> should take no arguments, and should return strings from the shell.
* <code>percent_to_graph(percent)</code> will take an integer 'percent' and return a bar graph that represents this percentage. The bar graph should begin with '[', and end with ']'. Then contents inside should be 20 characters long.