0
0
Intro to Computingfundamentals~10 mins

File system structure in Intro to Computing - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to represent the root directory symbol in a file system path.

Intro to Computing
root_path = "[1]"
Drag options to blanks, or click blank then click option'
A\
B/
C:
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using backslash which is common in Windows but not the root symbol in Unix.
Using colon or asterisk which are not directory symbols.
2fill in blank
medium

Complete the code to join folder names into a file path using the correct separator.

Intro to Computing
file_path = "home" + [1] + "user" + [1] + "documents"
Drag options to blanks, or click blank then click option'
A\
B|
C:
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using backslash which is used in Windows paths.
Using colon or pipe which are not valid folder separators.
3fill in blank
hard

Fix the error in the code to correctly represent a file path on Windows.

Intro to Computing
windows_path = "C:[1]Users[1]Public"
Drag options to blanks, or click blank then click option'
A\\
B/
C:
D|
Attempts:
3 left
💡 Hint
Common Mistakes
Using forward slash which is common in Unix but not Windows.
Using colon or pipe which are invalid separators.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps folder names to their depth level if depth is greater than 1.

Intro to Computing
folder_depths = {folder: [1] for folder, depth in folders.items() if depth [2] 1}
Drag options to blanks, or click blank then click option'
Adepth
B>
C<
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using the folder name instead of depth as the value.
Using wrong comparison operators like less than or equal.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase folder names to their depth if depth is less than or equal to 3.

Intro to Computing
filtered_folders = [1]: depth for folder, depth in folders.items() if depth [2] 3 and folder.isupper() == [3]
Drag options to blanks, or click blank then click option'
Afolder.upper()
B<=
CTrue
Dfolder.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase conversion instead of uppercase.
Using wrong comparison operators.
Checking folder.isupper() against False instead of True.