File size: 834 Bytes
c858401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def explain_code(code):
    """Provide a simple explanation of the generated code"""
    explanation = []
    
    if "<!DOCTYPE html>" in code:
        explanation.append("This is a complete HTML5 document.")
    
    if "<style>" in code or "style=" in code:
        explanation.append("The page includes CSS styling.")
    
    if "<script>" in code or "onclick=" in code:
        explanation.append("JavaScript functionality is included.")
    
    if "nav" in code or "navbar" in code:
        explanation.append("Contains a navigation bar.")
    
    if "dark mode" in code.lower():
        explanation.append("Includes dark/light mode toggle functionality.")
    
    if not explanation:
        return "The generated code appears to be a basic HTML page."
    
    return "The website includes:\n- " + "\n- ".join(explanation)