Input
dict | Output
dict | Instructions
dict |
---|---|---|
{
"0": "# a list containing strings and numbers\n\n# an empty list",
"1": "# access the first element\n\n# access the third element",
"2": "# access item at index 0\n\n# access item at index 2",
"3": "# items from index 2 to index 4\n\n# items from index 5 to end\n\n# items beginning to end",
"4": "# adding elements of one list to another",
"5": "# changing the third item to 'Blue'",
"6": "# deleting the second item\n\n# deleting items from index 1 to index 3",
"7": "# create a list with square values\n\n# Output: [1, 4, 9, 16, 25]"
} | {
"0": "student = ['Jack', 32, 'Computer Science']\nprint(student)\nempty_list = []\nprint(empty_list)",
"1": "languages = ['Python', 'Swift', 'C++']\nprint(languages[0]) # Python\nprint(languages[2]) # C++",
"2": "languages = ['Python', 'Swift', 'C++']\nprint(languages[-1]) # C++\nprint(languages[-3]) # Python",
"3": "my_list = ['p', 'r', 'o', 'g', 'r', 'a', 'm']\nprint(my_list[2:5])\nprint(my_list[5:])\nprint(my_list[:])",
"4": "numbers = [1, 3, 5]\nprint('Numbers:', numbers)\neven_numbers = [2, 4, 6]\nnumbers.extend(even_numbers)\nprint('Updated Numbers:', numbers)",
"5": "colors = ['Red', 'Black', 'Green']\nprint('Original List:', colors)\ncolors[2] = 'Blue'\nprint('Updated List:', colors)",
"6": "names = ['John', 'Eva', 'Laura', 'Nick', 'Jack']\ndel names[1]\nprint(names)\ndel names[1: 4]\nprint(names) # Error! List doesn't exist.",
"7": "numbers = [n**2 for n in range(1, 6)]\nprint(numbers)"
} | {
"0": "[INST] Instruction: # a list containing strings and numbers\n\n# an empty list [/INST] Output: student = ['Jack', 32, 'Computer Science']\nprint(student)\nempty_list = []\nprint(empty_list)",
"1": "[INST] Instruction: # access the first element\n\n# access the third element [/INST] Output: languages = ['Python', 'Swift', 'C++']\nprint(languages[0]) # Python\nprint(languages[2]) # C++",
"2": "[INST] Instruction: # access item at index 0\n\n# access item at index 2 [/INST] Output: languages = ['Python', 'Swift', 'C++']\nprint(languages[-1]) # C++\nprint(languages[-3]) # Python",
"3": "[INST] Instruction: # items from index 2 to index 4\n\n# items from index 5 to end\n\n# items beginning to end [/INST] Output: my_list = ['p', 'r', 'o', 'g', 'r', 'a', 'm']\nprint(my_list[2:5])\nprint(my_list[5:])\nprint(my_list[:])",
"4": "[INST] Instruction: # adding elements of one list to another [/INST] Output: numbers = [1, 3, 5]\nprint('Numbers:', numbers)\neven_numbers = [2, 4, 6]\nnumbers.extend(even_numbers)\nprint('Updated Numbers:', numbers)",
"5": "[INST] Instruction: # changing the third item to 'Blue' [/INST] Output: colors = ['Red', 'Black', 'Green']\nprint('Original List:', colors)\ncolors[2] = 'Blue'\nprint('Updated List:', colors)",
"6": "[INST] Instruction: # deleting the second item\n\n# deleting items from index 1 to index 3 [/INST] Output: names = ['John', 'Eva', 'Laura', 'Nick', 'Jack']\ndel names[1]\nprint(names)\ndel names[1: 4]\nprint(names) # Error! List doesn't exist.",
"7": "[INST] Instruction: # create a list with square values\n\n# Output: [1, 4, 9, 16, 25] [/INST] Output: numbers = [n**2 for n in range(1, 6)]\nprint(numbers)"
} |
No dataset card yet
- Downloads last month
- 6