0
0
SEO Fundamentalsknowledge~10 mins

Log file analysis in SEO Fundamentals - Interactive Code Practice

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

Complete the code to identify the type of log entry.

SEO Fundamentals
if '404' in log_entry: log_type = '[1]'
Drag options to blanks, or click blank then click option'
AError
BSuccess
CInfo
DWarning
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'Success' because 404 is a number.
Confusing 'Info' with error codes.
2fill in blank
medium

Complete the code to extract the IP address from a log line.

SEO Fundamentals
ip_address = log_line.split(' ')[[1]]
Drag options to blanks, or click blank then click option'
A0
B1
C2
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using index 1 or 2 which may not be the IP.
Using -1 which is the last element, not the IP.
3fill in blank
hard

Fix the error in the code to count how many times a specific URL appears in the log.

SEO Fundamentals
count = sum(1 for line in log if '[1]' in line)
Drag options to blanks, or click blank then click option'
AuRl
BURL
CUrl
Durl
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase or mixed case variable names.
Using a string literal instead of a variable.
4fill in blank
hard

Fill both blanks to create a dictionary of URLs and their visit counts from the log.

SEO Fundamentals
url_counts = {line.split(' ')[[1]]: url_counts.get(line.split(' ')[[2]], 0) + 1 for line in log}
Drag options to blanks, or click blank then click option'
A6
B5
C7
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Using different indices for key and get causing wrong counts.
Using incorrect indices that don't point to the URL.
5fill in blank
hard

Fill all three blanks to filter log entries by status code and create a summary dictionary.

SEO Fundamentals
summary = {line.split(' ')[[1]]: int(line.split(' ')[[2]]) for line in log if line.split(' ')[[3]] == '200'}
Drag options to blanks, or click blank then click option'
A6
B8
C9
D7
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong indices for URL or status code.
Filtering by wrong status code index.