I am writing a function to plot a graph. The problem is, there are restrictions on the inputs of the function that I am unsure how to put into code. For example, in
def PlotGraph(data, sex, c_list, status='current'):
The restrictions that I need to impose are the following:
The
PlotGraph
function must accept eithersex
orc_list
as in input, but not both. Sex is a string that can only be 'male' or 'female' and c_list is a list of integers.Status
must be either 'current' or 'previous', but defaulted at 'current', which I have implemented.
For (1) I have searched around but cannot find a method as to how only one of the two types of data can be inputted AND to impose what the variable type of either input must be. For (2) I have an idea to include in the function
if status != 'current' or 'previous':
print("Invalid input")
But I'm not sure if this will work if no input is submitted for status. If you have any ideas on how I can implement the stated restrictions, it would be much appreciated. Thank you.