Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to identify the platform type.
Intro to Computing
platform = '[1]' # Choose the platform type
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'desktop' instead of 'mobile' for mobile apps.
✗ Incorrect
The code sets the platform variable to 'mobile' to indicate a mobile app environment.
2fill in blank
mediumComplete the code to check if the application is a desktop app.
Intro to Computing
if app_type == '[1]': print('Running on desktop')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'mobile' instead of 'desktop' in the condition.
✗ Incorrect
The condition checks if the app_type is 'desktop' to confirm it's a desktop application.
3fill in blank
hardFix the error in the code that distinguishes app types.
Intro to Computing
def is_mobile(app): return app == '[1]'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Returning 'desktop' instead of 'mobile'.
✗ Incorrect
The function returns True if the app is 'mobile', correctly identifying mobile apps.
4fill in blank
hardFill both blanks to create a dictionary mapping app types to their platforms.
Intro to Computing
app_platforms = {
'WhatsApp': '[1]',
'Photoshop': '[2]'
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the platforms for WhatsApp and Photoshop.
✗ Incorrect
WhatsApp is a mobile app, and Photoshop is a desktop application.
5fill in blank
hardFill all three blanks to filter mobile apps from a list.
Intro to Computing
apps = ['WhatsApp', 'Photoshop', 'Instagram', 'Excel'] mobile_apps = [app for app in apps if app [1] ['WhatsApp', [2], [3]]]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of 'in' for membership check.
Including desktop apps like Excel in the mobile apps list.
✗ Incorrect
The list comprehension filters apps that are in the list of known mobile apps: WhatsApp, Instagram, and Snapchat.