Complete the code to print the name of an input device.
device = '[1]' print(device)
The keyboard is an input device used to type data into a computer.
Complete the code to check if the input device is a mouse.
if device == '[1]': print('This is a pointing device')
The mouse is a pointing input device used to control the cursor on the screen.
Fix the error in the code to correctly identify a touchscreen device.
device = 'touchscreen' if device [1] 'touchscreen': print('Input device detected')
The '==' operator checks if two values are equal, which is needed in an if condition.
Fill both blanks to create a list of input devices and print the first one.
input_devices = ['[1]', '[2]', 'touchscreen'] print(input_devices[0])
The list includes 'keyboard' and 'mouse' which are input devices. The first item printed is 'keyboard'.
Fill all three blanks to create a dictionary with device names as keys and their types as values.
devices = {
'[1]': 'input',
'[2]': 'input',
'[3]': 'output'
}
print(devices)The dictionary maps 'keyboard' and 'mouse' as input devices, and 'monitor' as an output device.