pykubegrader.widgets package#
Submodules#
pykubegrader.widgets.multiple_choice module#
- pykubegrader.widgets.multiple_choice.MCQ(descriptions: list[str], options: list[str] | list[list[str]], initial_vals: list[str]) Tuple[list[Column], list[RadioBoxGroup]] [source]#
- class pykubegrader.widgets.multiple_choice.MCQuestion(title='Select the option that matches the definition:', style=<function MCQ>, question_number=2, keys=['MC1', 'MC2', 'MC3', 'MC4'], options=[['List', 'Dictionary', 'Tuple', 'Set'], ['return', 'continue', 'pass', 'break'], ['*', '^', '**', '//'], ['list.add(element)', 'list.append(element)', 'list.insert(element)', 'list.push(element)']], descriptions=['Which of the following stores key:value pairs?', 'The following condition returns to the next iteration of the loop', 'Which operator is used for exponentiation in Python?', 'Which method is used to add an element to the end of a list in Python?'], points=2)[source]#
Bases:
SelectQuestion
pykubegrader.widgets.question_processor module#
pykubegrader.widgets.reading_question module#
- class pykubegrader.widgets.reading_question.ReadingPythonQuestion(title='Reading, Commenting, and Interpreting Python Code', question_number=4, key='READING1', options={'comments_options': [None, 'Initializes a list `numbers` with integers and floats', 'Initializes the variable `total` with a value of 0', 'A `for` loop that iterates through an iterator `numbers`', '`while` loop that continues to iterate until `total` is less than 9', 'Adds and assigns the variable `total` with the value of `num` plus 1', 'Statement that ends the `for` loop', 'Initializes a dictionary `numbers` with integers and floats', 'Initializes the class `total` with a value of 0', 'A `for` loop that iterates through an iterator `num`', '`while` loop that continues to iterate until `total` is less than or equal to 9', 'Adds the variable `total` with the value of `num` plus 1', 'Statement that ends the `while` loop', '`while` loop that continues to iterate while `total` is less than 9', 'Initializes a list `numbers` with integers and floats'], 'current_values': ['', 'None', '[5, 4.0]', '[5.0, 4.0]', '5.0', '6.0', '5', '6', '4.0', '4', '11.0', '11', '12', '12.0', '0', '0.0', 'True', 'False', 'N/A'], 'datatypes': ['', 'NoneType', 'list', 'dictionary', 'tuple', 'set', 'string', 'float', 'integer', 'boolean', 'N/A'], 'lines_to_comment': [1, 2, 4, 5, 6, 7], 'n_required': 8, 'n_rows': 12, 'table_headers': ['Step', 'Line Number', 'Variable Changed', 'Current Value', 'DataType'], 'variables_changed': ['', 'None', 'numbers', 'num', 'total', 'if', 'else']}, points=[20, 25])[source]#
Bases:
ReadingPython
pykubegrader.widgets.select_many module#
- pykubegrader.widgets.select_many.MultiSelect(descriptions: list[str], options: list[list[str]], initial_vals: list[bool])[source]#
- class pykubegrader.widgets.select_many.SelectMany(title='Select all statements which are TRUE', style=<function MultiSelect>, question_number=3, keys=['MS1', 'MS2', 'MS3', 'MS4', 'MS5'], options=[['`if` statements', '`for` loops', '`while` loops', '`end` statements'], ['dictionary', 'tuple', 'float', 'class'], ['A class can inherit attributes and methods from another class.', 'The `self` keyword is used to access variables that belong to a class.', '`__init__` runs on instantiation of a class.', 'Variables assigned in a class are always globally accessible.'], ['Keys in dictionaries are mutable.', 'It is possible to store a list of dictionaries in Python.', 'You can create multiple instances of a class with different values.', 'If `list1` is a list and you assign it to `list2` and append a value to `list2`, `list1` will also contain the value that was appended to `list2`.'], ['In `print(i)`, `i` must be a string.', '`2day` is not a valid variable name.', '`i` is not defined when evaluating the `while` loop.', '`i < 5` is not valid syntax to compare a variable `i` to an integer `5`, if `i` is a float.']], descriptions=['Which of the following control structures are used in Python? (Select all that apply)', 'Which of the following are built-in data structures in Python? (Select all that apply)', 'Concerning object-oriented programming in Python, which of the following statements are true? (Select all that apply)', 'Select all of the TRUE statements', '\n Select all the syntax errors in the following code:\n <pre>\n <code class="language-python">\n 2day = \'Tuesday\'\n while i < 5:\n print(i)\n i += 1.0\n </code>\n </pre>\n '], points=1, grade='all')[source]#
Bases:
MultiSelectQuestion
pykubegrader.widgets.student_info module#
pykubegrader.widgets.style module#
pykubegrader.widgets.true_false module#
- class pykubegrader.widgets.true_false.TFQuestion(title='Select if the statement is True or False', style=<function TFStyle>, question_number=2, keys=['MC1', 'MC2', 'MC3', 'MC4'], options=None, descriptions=['Which of the following stores key:value pairs?', 'The following condition returns to the next iteration of the loop', 'Which operator is used for exponentiation in Python?', 'Which method is used to add an element to the end of a list in Python?'], points=2)[source]#
Bases:
SelectQuestion
- pykubegrader.widgets.true_false.TFStyle(descriptions: List[str], options: List[str] | List[List[str]], initial_vals: List[str]) Tuple[List[HTML], List[RadioBoxGroup]] [source]#
Creates a styled True/False question layout with descriptions and radio buttons.
- Parameters:
- Returns:
Styled description panes and radio button groups.
- Return type:
Tuple[List[pn.pane.HTML], List[pn.widgets.RadioBoxGroup]]
pykubegrader.widgets.types_question module#
- pykubegrader.widgets.types_question.MultipleChoice(descriptions: list[str], options: list[str] | list[list[str]], initial_vals: list[str]) Tuple[list[HTML], list[Select]] [source]#
- class pykubegrader.widgets.types_question.TypesQuestion(title='Select the option that matches the definition:', style=<function MultipleChoice>, question_number=1, keys=['types1', 'types2', 'types3', 'types4', 'types5', 'types6'], options=['None', 'list', 'function', 'dictionary', 'array', 'variable', 'integer', 'string', 'tuple', 'iterator', 'float', 'object', 'class', 'module', 'package', 'instance'], descriptions=['An ordered, mutable collection of items, defined with [ ]', 'A file containing Python definitions and statements', 'A collection of elements of the same type, allowing for efficient storage and manipulation of sequences of data', 'An immutable and ordered collection of elements in Python, which can contain mixed data types', 'A sequence of Unicode characters', 'A data type that represents real numbers with a decimal point'], points=3)[source]#
Bases:
SelectQuestion